/// <summary> /// Adds one or more objects to one or more sequences. /// </summary> /// <param name="objectType">The object type.</param> /// <param name="searchOptions">The search options.</param> /// <param name="sequenceIds">A list of the sequence(s) to which objects should be added.</param> public async Task AddToSequenceAsync(ApiObjectType objectType, ApiSearchOptions searchOptions, IEnumerable <int> sequenceIds, CancellationToken cancellationToken = default) { sequenceIds.CheckNotNullOrEmpty(nameof(sequenceIds)); var query = new Dictionary <string, object?> { { "objectID", (int)objectType }, { "add_list", sequenceIds }, } .AddSearchOptions(searchOptions, true); await _apiRequest.PutAsync <object>( "objects/sequence", query, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Updates an existing object with given data. /// </summary> /// <param name="objectType">The object type.</param> /// <param name="objectId">The ID of the object to update.</param> /// <param name="values">Fields to set on the object.</param> /// <returns>A dictionary of updated fields.</returns> public async Task <Dictionary <string, string> > UpdateAsync(ApiObjectType objectType, int objectId, object?values = null) { var query = new Dictionary <string, object?> { { "objectID", (int)objectType }, { "id", objectId } }; var json = await _apiRequest.PutAsync <JObject>( "objects", query.AddObject(values)).ConfigureAwait(false); return(JsonData(json)["attrs"]?.ToObject <Dictionary <string, string> >() ?? throw new NullReferenceException(Properties.Resources.ResponseDataNull)); }