/// <summary> /// Reads the JSON representation of the object. /// </summary> public override object ReadJson( Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer ) { var catalogueEntry = new CatalogEntry(); while( reader.Read() && reader.TokenType == Newtonsoft.Json.JsonToken.PropertyName ) { switch( reader.Value.ToString() ) { case "key": catalogueEntry.Key = short.Parse( reader.ReadAsString(), CultureInfo.InvariantCulture ); break; case "attributes": reader.Read(); catalogueEntry.Attributes = serializer.Deserialize<DataService.Attribute[]>( reader ); break; } } return catalogueEntry; }
/// <summary> /// Adds the specified catalog entries to the catalog with uuid <paramref name="catalogUuid"/>. If the key <see cref="CatalogEntry.Key"/> /// is <code>-1</code>, the server will generate a new unique key for that entry. /// </summary> /// <param name="catalogUuid">The uuid of the catalog to add the entries to.</param> /// <param name="entries">The catalog entries to add.</param> /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param> public Task CreateCatalogEntries( Guid catalogUuid, CatalogEntry[] entries, CancellationToken cancellationToken = default(CancellationToken) ) { return Post( string.Format( "catalogs/{0}", catalogUuid ), entries, cancellationToken ); }
/// <summary> /// Adds the specified catalog entry to the catalog with uuid <paramref name="catalogUuid"/>. If the key <see cref="CatalogEntry.Key"/> /// is <code>-1</code>, the server will generate a new unique key for that entry. /// </summary> /// <param name="catalogUuid">The uuid of the catalog to add the entry to.</param> /// <param name="entry">The catalog entry to add.</param> /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param> public Task CreateCatalogEntry(Guid catalogUuid, CatalogEntry entry, CancellationToken cancellationToken = default(CancellationToken)) { return(CreateCatalogEntries(catalogUuid, new[] { entry }, cancellationToken)); }
/// <summary> /// Adds the specified catalog entry to the catalog with uuid <paramref name="catalogUuid"/>. If the key <see cref="CatalogEntry.Key"/> /// is <code>-1</code>, the server will generate a new unique key for that entry. /// </summary> /// <param name="catalogUuid">The uuid of the catalog to add the entry to.</param> /// <param name="entry">The catalog entry to add.</param> /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param> public Task CreateCatalogEntry( Guid catalogUuid, CatalogEntry entry, CancellationToken cancellationToken = default( CancellationToken ) ) { return CreateCatalogEntries( catalogUuid, new[] { entry }, cancellationToken ); }