Skip to content

Commit

Permalink
Mastodon APIのJSONに含まれるエンティティの定義を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed May 4, 2017
1 parent 46d555a commit af7f466
Show file tree
Hide file tree
Showing 7 changed files with 321 additions and 0 deletions.
73 changes: 73 additions & 0 deletions OpenTween/Api/DataModel/MastodonAccount.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// OpenTween - Client of Twitter
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
// All rights reserved.
//
// This file is part of OpenTween.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
// Boston, MA 02110-1301, USA.

using System.Runtime.Serialization;

namespace OpenTween.Api.DataModel
{
public class MastodonAccount
{
[DataMember(Name = "id")]
public long Id { get; set; }

[DataMember(Name = "username")]
public string Username { get; set; }

[DataMember(Name = "acct")]
public string Acct { get; set; }

[DataMember(Name = "display_name")]
public string DisplayName { get; set; }

[DataMember(Name = "locked")]
public bool Locked { get; set; }

[DataMember(Name = "created_at")]
public string CreatedAt { get; set; }

[DataMember(Name = "followers_count")]
public int FollowersCount { get; set; }

[DataMember(Name = "following_count")]
public int FollowingCount { get; set; }

[DataMember(Name = "statuses_count")]
public int StatusesCount { get; set; }

[DataMember(Name = "note")]
public string Note { get; set; }

[DataMember(Name = "url")]
public string Url { get; set; }

[DataMember(Name = "avatar")]
public string Avatar { get; set; }

[DataMember(Name = "avatar_static")]
public string AvatarStatic { get; set; }

[DataMember(Name = "header")]
public string Header { get; set; }

[DataMember(Name = "header_static")]
public string HeaderStatic { get; set; }
}
}
34 changes: 34 additions & 0 deletions OpenTween/Api/DataModel/MastodonApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// OpenTween - Client of Twitter
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
// All rights reserved.
//
// This file is part of OpenTween.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
// Boston, MA 02110-1301, USA.

using System.Runtime.Serialization;

namespace OpenTween.Api.DataModel
{
public class MastodonApplication
{
[DataMember(Name = "name")]
public string Name { get; set; }

[DataMember(Name = "website")] // Nullable
public string Website { get; set; }
}
}
46 changes: 46 additions & 0 deletions OpenTween/Api/DataModel/MastodonAttachment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// OpenTween - Client of Twitter
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
// All rights reserved.
//
// This file is part of OpenTween.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
// Boston, MA 02110-1301, USA.

using System.Runtime.Serialization;

namespace OpenTween.Api.DataModel
{
public class MastodonAttachment
{
[DataMember(Name = "id")]
public long Id { get; set; }

[DataMember(Name = "type")]
public string Type { get; set; }

[DataMember(Name = "url")]
public string Url { get; set; }

[DataMember(Name = "remote_url")]
public string RemoteUrl { get; set; }

[DataMember(Name = "preview_url")]
public string PreviewUrl { get; set; }

[DataMember(Name = "text_url")]
public string TextUrl { get; set; }
}
}
40 changes: 40 additions & 0 deletions OpenTween/Api/DataModel/MastodonMention.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// OpenTween - Client of Twitter
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
// All rights reserved.
//
// This file is part of OpenTween.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
// Boston, MA 02110-1301, USA.

using System.Runtime.Serialization;

namespace OpenTween.Api.DataModel
{
public class MastodonMention
{
[DataMember(Name = "url")]
public string Url { get; set; }

[DataMember(Name = "username")]
public string Username { get; set; }

[DataMember(Name = "acct")]
public string Acct { get; set; }

[DataMember(Name = "id")]
public long Id { get; set; }
}
}
88 changes: 88 additions & 0 deletions OpenTween/Api/DataModel/MastodonStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// OpenTween - Client of Twitter
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
// All rights reserved.
//
// This file is part of OpenTween.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
// Boston, MA 02110-1301, USA.

using System.Runtime.Serialization;

namespace OpenTween.Api.DataModel
{
public class MastodonStatus
{
[DataMember(Name = "id")]
public long Id { get; set; }

[DataMember(Name = "uri")]
public string Uri { get; set; }

[DataMember(Name = "url")]
public string Url { get; set; }

[DataMember(Name = "account")]
public MastodonAccount Account { get; set; }

[DataMember(Name = "in_reply_to_id")]
public long? InReplyToId { get; set; }

[DataMember(Name = "in_reply_to_account_id")]
public long? InReplyToAccountId { get; set; }

[DataMember(Name = "reblog")]
public MastodonStatus Reblog { get; set; }

[DataMember(Name = "content")]
public string Content { get; set; }

[DataMember(Name = "created_at")]
public string CreatedAt { get; set; }

[DataMember(Name = "reblogs_count")]
public int ReblogsCount { get; set; }

[DataMember(Name = "favourites_count")]
public int FavouritesCount { get; set; }

[DataMember(Name = "reblogged")]
public bool Reblogged { get; set; }

[DataMember(Name = "favourited")]
public bool Favourited { get; set; }

[DataMember(Name = "sensitive")]
public bool? Sensitive { get; set; }

[DataMember(Name = "spoiler_text")]
public string SpoilerText { get; set; }

[DataMember(Name = "visibility")]
public string Visibility { get; set; }

[DataMember(Name = "media_attachments")]
public MastodonAttachment[] MediaAttachments { get; set; }

[DataMember(Name = "mentions")]
public MastodonMention[] Mentions { get; set; }

[DataMember(Name = "tags")]
public MastodonTag[] Tags { get; set; }

[DataMember(Name = "application")]
public MastodonApplication Application { get; set; }
}
}
34 changes: 34 additions & 0 deletions OpenTween/Api/DataModel/MastodonTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// OpenTween - Client of Twitter
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
// All rights reserved.
//
// This file is part of OpenTween.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
// Boston, MA 02110-1301, USA.

using System.Runtime.Serialization;

namespace OpenTween.Api.DataModel
{
public class MastodonTag
{
[DataMember(Name = "name")]
public string Name { get; set; }

[DataMember(Name = "url")]
public string Url { get; set; }
}
}
6 changes: 6 additions & 0 deletions OpenTween/OpenTween.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
<Compile Include="Api\ApiLimit.cs" />
<Compile Include="Api\BitlyApi.cs" />
<Compile Include="Api\DataModel\GeoJson.cs" />
<Compile Include="Api\DataModel\MastodonAccount.cs" />
<Compile Include="Api\DataModel\MastodonApplication.cs" />
<Compile Include="Api\DataModel\MastodonAttachment.cs" />
<Compile Include="Api\DataModel\MastodonMention.cs" />
<Compile Include="Api\DataModel\MastodonStatus.cs" />
<Compile Include="Api\DataModel\MastodonTag.cs" />
<Compile Include="Api\DataModel\TwitterConfiguration.cs" />
<Compile Include="Api\DataModel\TwitterEntity.cs" />
<Compile Include="Api\DataModel\TwitterError.cs" />
Expand Down

0 comments on commit af7f466

Please sign in to comment.