Skip to content

Commit af7f466

Browse files
committed
Mastodon APIのJSONに含まれるエンティティの定義を追加
1 parent 46d555a commit af7f466

File tree

7 files changed

+321
-0
lines changed

7 files changed

+321
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// OpenTween - Client of Twitter
2+
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3+
// All rights reserved.
4+
//
5+
// This file is part of OpenTween.
6+
//
7+
// This program is free software; you can redistribute it and/or modify it
8+
// under the terms of the GNU General Public License as published by the Free
9+
// Software Foundation; either version 3 of the License, or (at your option)
10+
// any later version.
11+
//
12+
// This program is distributed in the hope that it will be useful, but
13+
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14+
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
// for more details.
16+
//
17+
// You should have received a copy of the GNU General Public License along
18+
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19+
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20+
// Boston, MA 02110-1301, USA.
21+
22+
using System.Runtime.Serialization;
23+
24+
namespace OpenTween.Api.DataModel
25+
{
26+
public class MastodonAccount
27+
{
28+
[DataMember(Name = "id")]
29+
public long Id { get; set; }
30+
31+
[DataMember(Name = "username")]
32+
public string Username { get; set; }
33+
34+
[DataMember(Name = "acct")]
35+
public string Acct { get; set; }
36+
37+
[DataMember(Name = "display_name")]
38+
public string DisplayName { get; set; }
39+
40+
[DataMember(Name = "locked")]
41+
public bool Locked { get; set; }
42+
43+
[DataMember(Name = "created_at")]
44+
public string CreatedAt { get; set; }
45+
46+
[DataMember(Name = "followers_count")]
47+
public int FollowersCount { get; set; }
48+
49+
[DataMember(Name = "following_count")]
50+
public int FollowingCount { get; set; }
51+
52+
[DataMember(Name = "statuses_count")]
53+
public int StatusesCount { get; set; }
54+
55+
[DataMember(Name = "note")]
56+
public string Note { get; set; }
57+
58+
[DataMember(Name = "url")]
59+
public string Url { get; set; }
60+
61+
[DataMember(Name = "avatar")]
62+
public string Avatar { get; set; }
63+
64+
[DataMember(Name = "avatar_static")]
65+
public string AvatarStatic { get; set; }
66+
67+
[DataMember(Name = "header")]
68+
public string Header { get; set; }
69+
70+
[DataMember(Name = "header_static")]
71+
public string HeaderStatic { get; set; }
72+
}
73+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// OpenTween - Client of Twitter
2+
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3+
// All rights reserved.
4+
//
5+
// This file is part of OpenTween.
6+
//
7+
// This program is free software; you can redistribute it and/or modify it
8+
// under the terms of the GNU General Public License as published by the Free
9+
// Software Foundation; either version 3 of the License, or (at your option)
10+
// any later version.
11+
//
12+
// This program is distributed in the hope that it will be useful, but
13+
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14+
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
// for more details.
16+
//
17+
// You should have received a copy of the GNU General Public License along
18+
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19+
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20+
// Boston, MA 02110-1301, USA.
21+
22+
using System.Runtime.Serialization;
23+
24+
namespace OpenTween.Api.DataModel
25+
{
26+
public class MastodonApplication
27+
{
28+
[DataMember(Name = "name")]
29+
public string Name { get; set; }
30+
31+
[DataMember(Name = "website")] // Nullable
32+
public string Website { get; set; }
33+
}
34+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// OpenTween - Client of Twitter
2+
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3+
// All rights reserved.
4+
//
5+
// This file is part of OpenTween.
6+
//
7+
// This program is free software; you can redistribute it and/or modify it
8+
// under the terms of the GNU General Public License as published by the Free
9+
// Software Foundation; either version 3 of the License, or (at your option)
10+
// any later version.
11+
//
12+
// This program is distributed in the hope that it will be useful, but
13+
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14+
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
// for more details.
16+
//
17+
// You should have received a copy of the GNU General Public License along
18+
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19+
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20+
// Boston, MA 02110-1301, USA.
21+
22+
using System.Runtime.Serialization;
23+
24+
namespace OpenTween.Api.DataModel
25+
{
26+
public class MastodonAttachment
27+
{
28+
[DataMember(Name = "id")]
29+
public long Id { get; set; }
30+
31+
[DataMember(Name = "type")]
32+
public string Type { get; set; }
33+
34+
[DataMember(Name = "url")]
35+
public string Url { get; set; }
36+
37+
[DataMember(Name = "remote_url")]
38+
public string RemoteUrl { get; set; }
39+
40+
[DataMember(Name = "preview_url")]
41+
public string PreviewUrl { get; set; }
42+
43+
[DataMember(Name = "text_url")]
44+
public string TextUrl { get; set; }
45+
}
46+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// OpenTween - Client of Twitter
2+
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3+
// All rights reserved.
4+
//
5+
// This file is part of OpenTween.
6+
//
7+
// This program is free software; you can redistribute it and/or modify it
8+
// under the terms of the GNU General Public License as published by the Free
9+
// Software Foundation; either version 3 of the License, or (at your option)
10+
// any later version.
11+
//
12+
// This program is distributed in the hope that it will be useful, but
13+
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14+
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
// for more details.
16+
//
17+
// You should have received a copy of the GNU General Public License along
18+
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19+
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20+
// Boston, MA 02110-1301, USA.
21+
22+
using System.Runtime.Serialization;
23+
24+
namespace OpenTween.Api.DataModel
25+
{
26+
public class MastodonMention
27+
{
28+
[DataMember(Name = "url")]
29+
public string Url { get; set; }
30+
31+
[DataMember(Name = "username")]
32+
public string Username { get; set; }
33+
34+
[DataMember(Name = "acct")]
35+
public string Acct { get; set; }
36+
37+
[DataMember(Name = "id")]
38+
public long Id { get; set; }
39+
}
40+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// OpenTween - Client of Twitter
2+
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3+
// All rights reserved.
4+
//
5+
// This file is part of OpenTween.
6+
//
7+
// This program is free software; you can redistribute it and/or modify it
8+
// under the terms of the GNU General Public License as published by the Free
9+
// Software Foundation; either version 3 of the License, or (at your option)
10+
// any later version.
11+
//
12+
// This program is distributed in the hope that it will be useful, but
13+
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14+
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
// for more details.
16+
//
17+
// You should have received a copy of the GNU General Public License along
18+
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19+
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20+
// Boston, MA 02110-1301, USA.
21+
22+
using System.Runtime.Serialization;
23+
24+
namespace OpenTween.Api.DataModel
25+
{
26+
public class MastodonStatus
27+
{
28+
[DataMember(Name = "id")]
29+
public long Id { get; set; }
30+
31+
[DataMember(Name = "uri")]
32+
public string Uri { get; set; }
33+
34+
[DataMember(Name = "url")]
35+
public string Url { get; set; }
36+
37+
[DataMember(Name = "account")]
38+
public MastodonAccount Account { get; set; }
39+
40+
[DataMember(Name = "in_reply_to_id")]
41+
public long? InReplyToId { get; set; }
42+
43+
[DataMember(Name = "in_reply_to_account_id")]
44+
public long? InReplyToAccountId { get; set; }
45+
46+
[DataMember(Name = "reblog")]
47+
public MastodonStatus Reblog { get; set; }
48+
49+
[DataMember(Name = "content")]
50+
public string Content { get; set; }
51+
52+
[DataMember(Name = "created_at")]
53+
public string CreatedAt { get; set; }
54+
55+
[DataMember(Name = "reblogs_count")]
56+
public int ReblogsCount { get; set; }
57+
58+
[DataMember(Name = "favourites_count")]
59+
public int FavouritesCount { get; set; }
60+
61+
[DataMember(Name = "reblogged")]
62+
public bool Reblogged { get; set; }
63+
64+
[DataMember(Name = "favourited")]
65+
public bool Favourited { get; set; }
66+
67+
[DataMember(Name = "sensitive")]
68+
public bool? Sensitive { get; set; }
69+
70+
[DataMember(Name = "spoiler_text")]
71+
public string SpoilerText { get; set; }
72+
73+
[DataMember(Name = "visibility")]
74+
public string Visibility { get; set; }
75+
76+
[DataMember(Name = "media_attachments")]
77+
public MastodonAttachment[] MediaAttachments { get; set; }
78+
79+
[DataMember(Name = "mentions")]
80+
public MastodonMention[] Mentions { get; set; }
81+
82+
[DataMember(Name = "tags")]
83+
public MastodonTag[] Tags { get; set; }
84+
85+
[DataMember(Name = "application")]
86+
public MastodonApplication Application { get; set; }
87+
}
88+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// OpenTween - Client of Twitter
2+
// Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3+
// All rights reserved.
4+
//
5+
// This file is part of OpenTween.
6+
//
7+
// This program is free software; you can redistribute it and/or modify it
8+
// under the terms of the GNU General Public License as published by the Free
9+
// Software Foundation; either version 3 of the License, or (at your option)
10+
// any later version.
11+
//
12+
// This program is distributed in the hope that it will be useful, but
13+
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14+
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
// for more details.
16+
//
17+
// You should have received a copy of the GNU General Public License along
18+
// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19+
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20+
// Boston, MA 02110-1301, USA.
21+
22+
using System.Runtime.Serialization;
23+
24+
namespace OpenTween.Api.DataModel
25+
{
26+
public class MastodonTag
27+
{
28+
[DataMember(Name = "name")]
29+
public string Name { get; set; }
30+
31+
[DataMember(Name = "url")]
32+
public string Url { get; set; }
33+
}
34+
}

OpenTween/OpenTween.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
<Compile Include="Api\ApiLimit.cs" />
7272
<Compile Include="Api\BitlyApi.cs" />
7373
<Compile Include="Api\DataModel\GeoJson.cs" />
74+
<Compile Include="Api\DataModel\MastodonAccount.cs" />
75+
<Compile Include="Api\DataModel\MastodonApplication.cs" />
76+
<Compile Include="Api\DataModel\MastodonAttachment.cs" />
77+
<Compile Include="Api\DataModel\MastodonMention.cs" />
78+
<Compile Include="Api\DataModel\MastodonStatus.cs" />
79+
<Compile Include="Api\DataModel\MastodonTag.cs" />
7480
<Compile Include="Api\DataModel\TwitterConfiguration.cs" />
7581
<Compile Include="Api\DataModel\TwitterEntity.cs" />
7682
<Compile Include="Api\DataModel\TwitterError.cs" />

0 commit comments

Comments
 (0)