Harmonize calls to Entity::check_valid().
This commit is contained in:
parent
a2aa33cf27
commit
5e6bf432a8
@ -24,27 +24,25 @@ using Account = Easy::Account;
|
||||
|
||||
bool Account::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"id",
|
||||
"username",
|
||||
"acct",
|
||||
"display_name",
|
||||
"locked",
|
||||
"created_at",
|
||||
"followers_count",
|
||||
"following_count",
|
||||
"statuses_count",
|
||||
"note",
|
||||
"url",
|
||||
"avatar",
|
||||
"avatar_static",
|
||||
"header",
|
||||
"header_static",
|
||||
"emojis"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"username",
|
||||
"acct",
|
||||
"display_name",
|
||||
"locked",
|
||||
"created_at",
|
||||
"followers_count",
|
||||
"following_count",
|
||||
"statuses_count",
|
||||
"note",
|
||||
"url",
|
||||
"avatar",
|
||||
"avatar_static",
|
||||
"header",
|
||||
"header_static",
|
||||
"emojis"
|
||||
});
|
||||
}
|
||||
|
||||
const string Account::acct() const
|
||||
|
@ -23,15 +23,13 @@ using Attachment = Easy::Attachment;
|
||||
|
||||
bool Attachment::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"id",
|
||||
"type",
|
||||
"url",
|
||||
"preview_url"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"type",
|
||||
"url",
|
||||
"preview_url"
|
||||
});
|
||||
}
|
||||
|
||||
double Attachment::aspect() const
|
||||
|
@ -22,15 +22,13 @@ using Card = Easy::Card;
|
||||
|
||||
bool Card::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"url",
|
||||
"title",
|
||||
"description",
|
||||
"type"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"url",
|
||||
"title",
|
||||
"description",
|
||||
"type"
|
||||
});
|
||||
}
|
||||
|
||||
const string Card::author_name() const
|
||||
|
@ -23,13 +23,11 @@ using Context = Easy::Context;
|
||||
|
||||
bool Context::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"ancestors",
|
||||
"descendants"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"ancestors",
|
||||
"descendants"
|
||||
});
|
||||
}
|
||||
|
||||
const std::vector<Easy::Status> Context::ancestors() const
|
||||
|
@ -22,15 +22,13 @@ using Emoji = Easy::Emoji;
|
||||
|
||||
bool Emoji::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"shortcode",
|
||||
"static_url",
|
||||
"url",
|
||||
"visible_in_picker"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"shortcode",
|
||||
"static_url",
|
||||
"url",
|
||||
"visible_in_picker"
|
||||
});
|
||||
}
|
||||
|
||||
const string Emoji::shortcode() const
|
||||
|
@ -24,11 +24,14 @@ using Filter = Easy::Filter;
|
||||
|
||||
bool Filter::valid() const
|
||||
{
|
||||
return Entity::check_valid({ "id",
|
||||
"phrase",
|
||||
"context",
|
||||
"irreversible",
|
||||
"whole_word" });
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"phrase",
|
||||
"context",
|
||||
"irreversible",
|
||||
"whole_word"
|
||||
});
|
||||
}
|
||||
|
||||
const string Filter::id() const
|
||||
|
@ -24,18 +24,16 @@ using Instance = Easy::Instance;
|
||||
|
||||
bool Instance::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"uri",
|
||||
"title",
|
||||
"description",
|
||||
"email",
|
||||
"version",
|
||||
"urls",
|
||||
"languages"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"uri",
|
||||
"title",
|
||||
"description",
|
||||
"email",
|
||||
"version",
|
||||
"urls",
|
||||
"languages"
|
||||
});
|
||||
}
|
||||
|
||||
const Easy::Account Instance::contact_account() const
|
||||
|
@ -23,13 +23,11 @@ using std::uint64_t;
|
||||
|
||||
bool List::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{
|
||||
"id",
|
||||
"title"
|
||||
};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"title"
|
||||
});
|
||||
}
|
||||
|
||||
const string List::id() const
|
||||
|
@ -21,15 +21,13 @@ using Mention = Easy::Mention;
|
||||
|
||||
bool Mention::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"url",
|
||||
"username",
|
||||
"acct",
|
||||
"id"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"url",
|
||||
"username",
|
||||
"acct",
|
||||
"id"
|
||||
});
|
||||
}
|
||||
|
||||
const string Mention::acct() const
|
||||
|
@ -22,15 +22,13 @@ using Notification = Easy::Notification;
|
||||
|
||||
bool Notification::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"id",
|
||||
"type",
|
||||
"created_at",
|
||||
"account"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"type",
|
||||
"created_at",
|
||||
"account"
|
||||
});
|
||||
}
|
||||
|
||||
const Easy::Account Notification::account() const
|
||||
|
@ -26,14 +26,12 @@ const string PushSubscription::id() const
|
||||
|
||||
bool PushSubscription::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"id",
|
||||
"endpoint",
|
||||
"server_key"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"endpoint",
|
||||
"server_key"
|
||||
});
|
||||
}
|
||||
|
||||
const string PushSubscription::endpoint() const
|
||||
|
@ -21,19 +21,17 @@ using Relationship = Easy::Relationship;
|
||||
|
||||
bool Relationship::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"id",
|
||||
"following",
|
||||
"followed_by",
|
||||
"blocking",
|
||||
"muting",
|
||||
"muting_notifications",
|
||||
"requested",
|
||||
"domain_blocking"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"following",
|
||||
"followed_by",
|
||||
"blocking",
|
||||
"muting",
|
||||
"muting_notifications",
|
||||
"requested",
|
||||
"domain_blocking"
|
||||
});
|
||||
}
|
||||
|
||||
bool Relationship::blocking() const
|
||||
|
@ -21,13 +21,11 @@ using Report = Easy::Report;
|
||||
|
||||
bool Report::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"id",
|
||||
"action_taken"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"action_taken"
|
||||
});
|
||||
}
|
||||
|
||||
bool Report::action_taken() const
|
||||
|
@ -23,14 +23,12 @@ using Results = Easy::Results;
|
||||
|
||||
bool Results::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"accounts",
|
||||
"statuses",
|
||||
"hashtags"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"accounts",
|
||||
"statuses",
|
||||
"hashtags"
|
||||
});
|
||||
}
|
||||
|
||||
const std::vector<Easy::Account> Results::accounts() const
|
||||
|
@ -24,27 +24,25 @@ using Status = Easy::Status;
|
||||
|
||||
bool Status::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"id",
|
||||
"uri",
|
||||
"account",
|
||||
"content",
|
||||
"created_at",
|
||||
"emojis",
|
||||
"replies_count",
|
||||
"reblogs_count",
|
||||
"favourites_count",
|
||||
"sensitive",
|
||||
"spoiler_text",
|
||||
"visibility",
|
||||
"media_attachments",
|
||||
"mentions",
|
||||
"tags",
|
||||
"application"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"id",
|
||||
"uri",
|
||||
"account",
|
||||
"content",
|
||||
"created_at",
|
||||
"emojis",
|
||||
"replies_count",
|
||||
"reblogs_count",
|
||||
"favourites_count",
|
||||
"sensitive",
|
||||
"spoiler_text",
|
||||
"visibility",
|
||||
"media_attachments",
|
||||
"mentions",
|
||||
"tags",
|
||||
"application"
|
||||
});
|
||||
}
|
||||
|
||||
const Easy::Account Status::account() const
|
||||
|
@ -25,13 +25,11 @@ using Tag = Easy::Tag;
|
||||
|
||||
bool Tag::valid() const
|
||||
{
|
||||
const std::vector<string> attributes =
|
||||
{{
|
||||
"name",
|
||||
"url"
|
||||
}};
|
||||
|
||||
return Entity::check_valid(attributes);
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"name",
|
||||
"url"
|
||||
});
|
||||
}
|
||||
|
||||
const string Tag::name() const
|
||||
|
@ -21,10 +21,13 @@ using Token = Easy::Token;
|
||||
|
||||
bool Token::valid() const
|
||||
{
|
||||
return Entity::check_valid({"access_token",
|
||||
"token_type",
|
||||
"scope",
|
||||
"created_at"});
|
||||
return Entity::check_valid(
|
||||
{
|
||||
"access_token",
|
||||
"token_type",
|
||||
"scope",
|
||||
"created_at"
|
||||
});
|
||||
}
|
||||
|
||||
const string Token::access_token() const
|
||||
|
Reference in New Issue
Block a user