// OpenTween - Client of Twitter // Copyright (c) 2014 kim_upsilon (@kim_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 , or write to // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, // Boston, MA 02110-1301, USA. using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace OpenTween.Api.DataModel { // 参照: https://dev.twitter.com/docs/error-codes-responses [DataContract] public class TwitterError { [DataMember(Name = "errors")] public TwitterErrorItem[] Errors { get; set; } /// public static TwitterError ParseJson(string json) { return MyCommon.CreateDataFromJson(json); } } [DataContract] public class TwitterErrorItem { [DataMember(Name = "code")] public TwitterErrorCode Code { get; set; } [DataMember(Name = "message")] public string Message { get; set; } public override string ToString() { if (Enum.IsDefined(typeof(TwitterErrorCode), this.Code)) return this.Code.ToString(); else return this.Message; } } /// /// Twitter API から返されるエラーコード /// public enum TwitterErrorCode { /// /// 不正なリクエスト等によって認証を完了できない場合に発生する。大体クライアントのせい /// AuthError = 32, /// /// 指定されたリソースが存在しません。HTTP 404 と同等 /// NotFound = 34, /// /// アカウントが凍結されています /// SuspendedAccount = 64, /// /// REST API v1 は星になりました /// APIv1Retired = 68, /// /// レートリミットに到達しました /// RateLimit = 88, /// /// アクセストークンが無効です。不正なトークンまたはユーザーによって失効されています /// InvalidToken = 89, /// /// SSLを使わずにAPIに接続することはできません /// SslIsRequired = 92, /// /// サーバーの過負荷によって一時的にアクセスできません /// OverCapacity = 130, /// /// サーバーの内部エラー /// InternalError = 131, /// /// oauth_timestamp の時刻が無効。クライアントかサーバーの時計が大幅にずれている /// TimestampOutOfRange = 135, /// /// ユーザーからブロックされている (公式ドキュメントに記述無し) /// Blocked = 136, /// /// 既にふぁぼっているツイートをふぁぼろうとした (公式ドキュメントに記述無し) /// AlreadyFavorited = 139, /// /// 存在しないステータスID /// StatusNotFound = 144, /// /// 投稿されたメッセージが重複しています /// /// /// “There was an error sending your message: Whoops! You already said that.” /// /direct_messages/new.json で重複するDMを送信すると発生 /// DuplicateMessage = 151, /// /// フォローの追加が制限されています /// FollowLimit = 161, /// /// 非公開ユーザーのため閲覧できません /// Protected = 179, /// /// 一日当たりの投稿可能なツイート数の制限に達しました /// DailyLimitReached = 185, /// /// 投稿されたステータスが重複しています /// DuplicateStatus = 187, /// /// 認証が必要な API で認証データが含まれていない、または認証データが不正 /// AuthenticationRequired = 215, /// /// スパムの疑いのあるリクエストがブロックされました /// RequestBlocked = 226, /// /// 廃止されたエンドポイント /// RetiredEndpoint = 251, /// /// アプリケーションの書き込み権限が規制されています /// AppWriteRestricted = 261, /// /// 自分自身をミュートに設定することはできません /// CantMuteYourself = 271, /// /// ミュート設定されていないユーザーをミュート解除しようとしています /// NotMuting = 272, /// /// 投稿されたDMが重複しています /// /// /// “Direct Message is a duplicate.” /// /statuses/update.json に「D screen_name ...」形式で重複したDMを送信すると発生 /// DuplicateDM = 311, /// /// DMで投稿可能な文字数を超えています /// DMCharacterLimit = 354, } }