Introduce byLikes parameter to AddBlog, AddPost, and UpdatePost methods, updating SQL logic and schema to store this flag. Ensure all relevant calls and SQL statements handle the new ByLikes column, allowing tracking of whether entries were added "by likes." Also standardize hasImage boolean handling in SQL. Add Tumblr likes fetching and DB tracking support Implemented -likes command to fetch/process Tumblr blog likes. Added DB columns and logic to track likes progress (LikesPulled, LikesCursor). Integrated API call, pagination, and rate-limit handling for likes. Extended AddBlog/AddPost/UpdatePost for likes-related fields. Added DateModified tracking to DB operations. Improved error handling and updated launch/app settings.
140 lines
3.6 KiB
C#
140 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
namespace URLNotesGrabberCORE
|
|
{
|
|
internal class ResponseNotes
|
|
{
|
|
}
|
|
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
|
|
public class AvatarUrl
|
|
{
|
|
[JsonProperty("64")]
|
|
public string _64 { get; set; }
|
|
|
|
[JsonProperty("128")]
|
|
public string _128 { get; set; }
|
|
}
|
|
|
|
public class Links
|
|
{
|
|
public Next next { get; set; }
|
|
}
|
|
|
|
public class Meta
|
|
{
|
|
public int status { get; set; }
|
|
public string msg { get; set; }
|
|
}
|
|
|
|
public class Next
|
|
{
|
|
public string href { get; set; }
|
|
public string method { get; set; }
|
|
public QueryParams query_params { get; set; }
|
|
}
|
|
|
|
public class Note
|
|
{
|
|
public string type { get; set; }
|
|
public int timestamp { get; set; }
|
|
public string blog_name { get; set; }
|
|
public string blog_uuid { get; set; }
|
|
public string blog_url { get; set; }
|
|
public bool followed { get; set; }
|
|
public string avatar_shape { get; set; }
|
|
public AvatarUrl avatar_url { get; set; }
|
|
public string post_id { get; set; }
|
|
public string reblog_parent_blog_name { get; set; }
|
|
}
|
|
|
|
public class QueryParams
|
|
{
|
|
public string mode { get; set; }
|
|
public string id { get; set; }
|
|
public string before_timestamp { get; set; }
|
|
public string before { get; set; }
|
|
public string after { get; set; }
|
|
}
|
|
|
|
public class Response
|
|
{
|
|
public List<Note> notes { get; set; }
|
|
public int total_notes { get; set; }
|
|
public bool is_subscribed { get; set; }
|
|
public bool can_subscribe { get; set; }
|
|
public bool can_hide_or_delete_notes { get; set; }
|
|
public bool conversational_notifications_enabled { get; set; }
|
|
public Links _links { get; set; }
|
|
}
|
|
|
|
public class Root
|
|
{
|
|
public Meta meta { get; set; }
|
|
[JsonConverter(typeof(EmptyArrayOrObjectConverter<Response>))]
|
|
public Response response { get; set; }
|
|
|
|
public string statusCode { get; set; }
|
|
|
|
public int retryInSeconds { get; set; }
|
|
|
|
public string rawJson { get; set; }
|
|
}
|
|
|
|
// Classes for Posts API endpoint (for reply_text)
|
|
public class PostsResponse
|
|
{
|
|
public List<Post> posts { get; set; }
|
|
}
|
|
|
|
public class Post
|
|
{
|
|
public long id { get; set; }
|
|
public List<NoteDetail> notes { get; set; }
|
|
}
|
|
|
|
public class NoteDetail
|
|
{
|
|
public long timestamp { get; set; }
|
|
public string type { get; set; }
|
|
public string blog_name { get; set; }
|
|
public string reply_text { get; set; }
|
|
}
|
|
|
|
public class PostsRoot
|
|
{
|
|
public Meta meta { get; set; }
|
|
[JsonConverter(typeof(EmptyArrayOrObjectConverter<PostsResponse>))]
|
|
public PostsResponse response { get; set; }
|
|
|
|
public string statusCode { get; set; }
|
|
|
|
public int retryInSeconds { get; set; }
|
|
|
|
public string rawJson { get; set; }
|
|
}
|
|
|
|
public class LikesResponse
|
|
{
|
|
public List<dynamic> liked_posts { get; set; }
|
|
public int liked_count { get; set; }
|
|
public Links _links { get; set; }
|
|
}
|
|
|
|
public class LikesRoot
|
|
{
|
|
public Meta meta { get; set; }
|
|
[JsonConverter(typeof(EmptyArrayOrObjectConverter<LikesResponse>))]
|
|
public LikesResponse response { get; set; }
|
|
|
|
public string statusCode { get; set; }
|
|
public int retryInSeconds { get; set; }
|
|
public string rawJson { get; set; }
|
|
}
|
|
}
|