Use official data to generate errors/types & regenerate

This commit is contained in:
Roj Serbest 2021-11-11 16:03:45 +03:00
parent 5775183206
commit 730bf78621
12 changed files with 1213 additions and 854 deletions

828
generators/data.json Normal file
View File

@ -0,0 +1,828 @@
{
"version": "1.0",
"errors": [
{
"id": "a11757c4",
"name": "AlreadyAuthenticated",
"description": "The client is attempting to authenticate when already authenticated",
"error_code": 8713
},
{
"id": "1458e573",
"name": "AuthenticationFailure",
"description": "The authentication process failed for some unexpected reason, see the message for further details",
"error_code": 8710
},
{
"id": "e81059bf",
"name": "AuthenticationNotApplicable",
"description": "Raised when the user does not support this method of authentication, see the message for further details",
"error_code": 8706
},
{
"id": "9f37b285",
"name": "BadSessionChallengeAnswer",
"description": "The given session challenge answer is incorrect or out of sync",
"error_code": 8711
},
{
"id": "5e1c10ae",
"name": "IncorrectLoginCredentials",
"description": "The given login credentials are incorrect",
"error_code": 8704
},
{
"id": "2e9060cf",
"name": "IncorrectTwoFactorAuthenticationCode",
"description": "The given two-factor authentication code is incorrect",
"error_code": 8705
},
{
"id": "02868471",
"name": "NotAuthenticated",
"description": "Raised when the client attempts to invoke a method that requires authentication",
"error_code": 8708
},
{
"id": "a9634560",
"name": "PrivateAccessTokenRequired",
"description": "Raised when the user/entity uses a Private Access Token to authenticate and the client attempted to authenticate in another way",
"error_code": 8709
},
{
"id": "d8f9191f",
"name": "SessionExpired",
"description": "Raised when trying to use a session that has expired",
"error_code": 8714
},
{
"id": "c4dd3574",
"name": "TwoFactorAuthenticationRequired",
"description": "Two-Factor Authentication is required, the client must repeat the same request but provide a Two-Factor authentication code as well",
"error_code": 8712
},
{
"id": "ffed1d8d",
"name": "AccessDenied",
"description": "The authenticated peer does not have sufficient permissions to access the requested resource or to invoke a restricted method",
"error_code": 12550
},
{
"id": "cca04d0c",
"name": "AlreadyReposted",
"description": "Raised when the client attempts to repost a post that has already been reposted",
"error_code": 12547
},
{
"id": "c78cf37b",
"name": "BlockedByPeer",
"description": "Raised when attempting to interact with a peer that blocked you",
"error_code": 12551
},
{
"id": "b518774e",
"name": "BlockedPeer",
"description": "Raised when attempting to interact with a peer that you blocked",
"error_code": 12552
},
{
"id": "aadafa63",
"name": "DocumentNotFound",
"description": "The requested Document ID was not found on the server",
"error_code": 12549
},
{
"id": "9c8e7563",
"name": "FileUploadError",
"description": "Raised when there was an error while trying to upload one or more files to the network",
"error_code": 12548
},
{
"id": "8faa072e",
"name": "PeerNotFound",
"description": "The requested user entity was not found in the network",
"error_code": 12544
},
{
"id": "9f19935e",
"name": "PostDeleted",
"description": "Raised when the client requested a post that was deleted",
"error_code": 12546
},
{
"id": "7a69136f",
"name": "PostNotFound",
"description": "Raised when the client requested a post that isn't found",
"error_code": 12545
},
{
"id": "10dee597",
"name": "SelfInteractionNotPermitted",
"description": "Raised when attempting to invoke a method or change that involves a peer that you are authenticated as such as following a peer that you are authenticated as",
"error_code": 12553
},
{
"id": "9d02379e",
"name": "DocumentUpload",
"description": "Raised when there was an error while trying to process the document upload",
"error_code": 16385
},
{
"id": "4c9bdb87",
"name": "InternalServerError",
"description": "Raised when there was an unexpected error while trying to process your request.",
"error_code": 16384
},
{
"id": "f1ce4792",
"name": "AgreementRequired",
"description": "The client/user must agree to the condition to invoke the method",
"error_code": 8465
},
{
"id": "f95f5f97",
"name": "FileTooLarge",
"description": "The given file is too large to be processed",
"error_code": 8463
},
{
"id": "8f15d1dd",
"name": "InvalidAttachments",
"description": "Raised when the given attachments are invalid",
"error_code": 8470
},
{
"id": "ef2dd55d",
"name": "InvalidBiography",
"description": "The Biography is too long or contains invalid characters, see the message for further details",
"error_code": 8452
},
{
"id": "d22f8f4d",
"name": "InvalidClientName",
"description": "The client name contains invalid characters or is too long, see the message for further details",
"error_code": 8460
},
{
"id": "8980306d",
"name": "InvalidClientPrivateHash",
"description": "The client's private hash is invalid and cannot be identified as a sha256",
"error_code": 8457
},
{
"id": "6207f5b7",
"name": "InvalidClientPublicHash",
"description": "The client's public hash is invalid and cannot be identified as a sha256",
"error_code": 8456
},
{
"id": "8ce0e2a7",
"name": "InvalidFileForProfilePicture",
"description": "The given file is invalid for a profile picture",
"error_code": 8462
},
{
"id": "1209e4fc",
"name": "InvalidFileName",
"description": "Raised when the given filename is invalid",
"error_code": 8471
},
{
"id": "1209e4fc",
"name": "InvalidFileName",
"description": "Raised when the given filename is invalid",
"error_code": 8471
},
{
"id": "8611fbfa",
"name": "InvalidGeoLocation",
"description": "The given geo location value is invalid or too long",
"error_code": 8467
},
{
"id": "ea3e3974",
"name": "InvalidHelpDocumentId",
"description": "The given Help Document ID is invalid",
"error_code": 8464
},
{
"id": "de95bed6",
"name": "InvalidLastName",
"description": "The Last Name provided contains invalid characters and or is too long, see the message for further details",
"error_code": 8451
},
{
"id": "0f5d11ea",
"name": "InvalidPageValue",
"description": "The page parameter contains an invalid value. It cannot be a negative value or 0, see the message for further details",
"error_code": 8466
},
{
"id": "7fab61d5",
"name": "InvalidPassword",
"description": "The given password is insecure, see the message for further details",
"error_code": 8449
},
{
"id": "468b8e27",
"name": "InvalidPeerInput",
"description": "The client provided an invalid peer identification as input",
"error_code": 8454
},
{
"id": "54854690",
"name": "InvalidPlatform",
"description": "The platform name contains invalid characters or is too long, see the message for further details",
"error_code": 8464
},
{
"id": "f1351689",
"name": "InvalidPostText",
"description": "The post contains invalid characters or is too long, see the message for further details",
"error_code": 8455
},
{
"id": "0eefbfa9",
"name": "InvalidSessionIdentification",
"description": "The session identification object is invalid, see the message for further details",
"error_code": 8461
},
{
"id": "ad680e22",
"name": "InvalidUrlValue",
"description": "The given URL input is invalid",
"error_code": 8468
},
{
"id": "751ca3d3",
"name": "InvalidUsername",
"description": "The given username is invalid and does not meet the specification",
"error_code": 8448
},
{
"id": "b4fa64b8",
"name": "InvalidVersion",
"description": "The version is invalid or is too long, see the message for further details",
"error_code": 8459
},
{
"id": "68181c93",
"name": "TooManyAttachments",
"description": "Raised when the amount of attachments exceeds what the server supports",
"error_code": 8469
},
{
"id": "a890f5d6",
"name": "UsernameAlreadyExists",
"description": "The username is already registered in the network and cannot be used",
"error_code": 8453
}
],
"objects": [
{
"id": "8245989e",
"name": "DisplayPictureSize",
"description": "This object describes the size of a display picture followed by a document object that results in said display picture size.",
"parameters": [
{
"name": "width",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The width of the image"
},
{
"name": "height",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The height of the image"
},
{
"name": "document",
"types": [{ "type": "Document", "vector": false }],
"required": true,
"description": "The document object that points to the display picture"
}
]
},
{
"id": "54bd4374",
"name": "Document",
"description": "A document object contains basic information about the file associated with the document and the document ID used to retrieve the document from the CDN Server",
"parameters": [
{
"name": "id",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The ID of the document"
},
{
"name": "file_mime",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The Mime of the file"
},
{
"name": "file_name",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The original name of the file"
},
{
"name": "file_size",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The size of the file in bytes"
},
{
"name": "file_type",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The type of file detected by the server"
},
{
"name": "flags",
"types": [{ "type": "string", "vector": true }],
"required": true,
"description": "An array of flags associated with this document"
}
]
},
{
"id": "4182559c",
"name": "HelpDocument",
"description": "A help document is often retrieved from the server as a way to represent a document to the user for multiple purposes, from quick guides to server announcements or the legal documents required to be shown to the user before they register an account to the network.",
"parameters": [
{
"name": "id",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The ID of the document, if the document gets updated then the ID will change"
},
{
"name": "text",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The text contents of the document"
},
{
"name": "entities",
"types": [{ "type": "TextEntity", "vector": true }],
"required": true,
"description": "An array of text entities being represented in the text"
}
]
},
{
"id": "1483f7dc",
"name": "Peer",
"description": "A peer object provides a basic description and identification a peer entity that can contain information used to identify a peer on the client or basic flags and properties of the peer to pre-determine what actions are available for a peer.",
"parameters": [
{
"name": "id",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The ID of the document, if the document gets updated then the ID will change"
},
{
"name": "type",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The type of the peer entity"
},
{
"name": "name",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The display name of the peer"
},
{
"name": "username",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The username associated with this peer"
},
{
"name": "flags",
"types": [{ "type": "string", "vector": true }],
"required": true,
"description": "Flags associated with this peer"
}
]
},
{
"id": "25d7823e",
"name": "Post",
"description": "A post object is used to represent a post submitted either by a peer, this object can contain recursive objects.",
"parameters": [
{
"name": "id",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The unique ID for the post"
},
{
"name": "type",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The post type used to represent the true intention of the post"
},
{
"name": "peer",
"types": [
{ "type": "Peer", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The author peer of the post, this property can be null if the post was deleted."
},
{
"name": "source",
"types": [
{ "type": "string", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The source for where this post was composed from or collected from (eg; the client the user is using or the third-party source that the post was collected. This is determined by the server). This property can be null if the post was deleted."
},
{
"name": "text",
"types": [
{ "type": "string", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The text content of the post source. This property can be null if the post has been deleted"
},
{
"name": "attachments",
"types": [{ "type": "Document", "vector": true }],
"required": true,
"description": "An array of attached documents to the post"
},
{
"name": "entities",
"types": [{ "type": "TextEntity", "vector": true }],
"required": true,
"description": "An array of entities extracted from the text, can be used by the client to highlight clickable entities that preforms an action."
},
{
"name": "mentioned_peers",
"types": [{ "type": "Peer", "vector": true }],
"required": true,
"description": "An array of resolved peers that was mentioned in the post text."
},
{
"name": "reply_to_post",
"types": [
{ "type": "Post", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The original post that this post is replying to if applicable, otherwise null."
},
{
"name": "quoted_post",
"types": [
{ "type": "Post", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The original post that this post is quoting if applicable, otherwise null"
},
{
"name": "reposted_post",
"types": [
{ "type": "Post", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The original post that this post is reposting if applicable, otherwise null"
},
{
"name": "original_thread_post",
"types": [
{ "type": "Post", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The original thread post, only applicable to replies. This value indicates the main thread post where all the replies originated from. This value will remain the same for all sub-replies of the main post."
},
{
"name": "like_count",
"types": [
{ "type": "integer", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The amount of likes that this post has if applicable, otherwise null"
},
{
"name": "repost_count",
"types": [
{ "type": "integer", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The amount of repost that this post has if applicable, otherwise null"
},
{
"name": "quote_count",
"types": [
{ "type": "integer", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The amount of quoted posts that this post has if applicable, otherwise null"
},
{
"name": "reply_count",
"types": [
{ "type": "integer", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The amount of replies that this post has if applicable, otherwise null"
},
{
"name": "posted_timestamp",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The Unix Timestamp for when this post was created"
},
{
"name": "flags",
"types": [{ "type": "string", "vector": true }],
"required": true,
"description": "The flags associated with this post"
}
]
},
{
"id": "50f2328a",
"name": "Profile",
"description": "The profile object provides a profile display for a peer entity, this is mainly used to represent a \"Profile\" display of a peer.",
"parameters": [
{
"name": "first_name",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The first name of the entity"
},
{
"name": "last_name",
"types": [
{ "type": "string", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The last name of the entity"
},
{
"name": "name",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The full display name of the entity"
},
{
"name": "biography",
"types": [
{ "type": "string", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "A biography or description of the entity"
},
{
"name": "location",
"types": [
{ "type": "string", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The location of the entity"
},
{
"name": "url",
"types": [
{ "type": "string", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The URL of the entity (Can be a website or a blog, etc)"
},
{
"name": "followers_count",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The amount of followers that this entity has"
},
{
"name": "following_count",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The amount of peers that this entity is following"
},
{
"name": "display_picture_sizes",
"types": [{ "type": "DisplayPictureSize", "vector": true }],
"required": true,
"description": "An array of display picture size objects that represents the entity's display picture"
}
]
},
{
"id": "456ff4c6",
"name": "ServerInformation",
"description": "The ServerInformation object is a simple object that gives details about the server's attributes and limits or location of other servers that the client should communicate to for other purposes such as a CDN.",
"parameters": [
{
"name": "network_name",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The name of the network, eg; \"Socialvoid\""
},
{
"name": "protocol_version",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The version of the protocol standard that the server is using, eg; \"1.0\""
},
{
"name": "cdn_server",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The HTTP URL Endpoint for the CDN server of the network"
},
{
"name": "upload_max_file_size",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum size of a file that you can upload to the CDN Server (in bytes)"
},
{
"name": "unauthorized_session_ttl",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum time-to-live (in seconds) that an unauthorized session may have. The server will often reset the expiration whenever the session is used."
},
{
"name": "authorized_session_ttl",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum time-to-live (in seconds) that an authorized session may have. The server will often reset the expiration whenever the session is used."
},
{
"name": "retrieve_likes_max_limit",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum amount of likes a client can retrieve at once using the method timeline.get_likes via the page parameter"
},
{
"name": "retrieve_reposts_max_limit",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum amount of reposts a client can retrieve at once using the method timeline.get_reposted_peers via the page parameter"
},
{
"name": "retrieve_replies_max_limit",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum amount of replies a client can retrieve at once using the method timeline.get_replies via the page parameter"
},
{
"name": "retrieve_quotes_max_limit",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum amount of quotes a client can retrieve at once using the method timeline.get_quotes via the page parameter"
},
{
"name": "retrieve_followers_max_limit",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum amount of followers a client can retrieve at once using the method network.get_followers via the page parameter"
},
{
"name": "retrieve_following_max_limit",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The maximum amount of following peers a client can retrieve at once using the method network.get_following via the page parameter"
},
{
"name": "retrieve_feed_max_limit",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The amount of posts a client can retrieve at once using the method timeline.retrieve_feed via the page parameter"
}
]
},
{
"id": "1647b140",
"name": "Session",
"description": "A session object is contains basic information about the session.",
"parameters": [
{
"name": "id",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The ID of the session obtained when establishing a session"
},
{
"name": "flags",
"types": [{ "type": "string", "vector": true }],
"required": true,
"description": "An array of flags that has been set to this session"
},
{
"name": "authenticated",
"types": [{ "type": "boolean", "vector": false }],
"required": true,
"description": "Indicates if the session is currently authenticated to a user"
},
{
"name": "created",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The Unix Timestamp for when this session was first created"
},
{
"name": "expires",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The Unix Timestamp for when this session expires"
}
]
},
{
"id": "14907b74",
"name": "SessionEstablished",
"description": "A SessionEstablished object is returned when you create a session. This object returns basic information about the session that the server has created for you.",
"parameters": [
{
"name": "id",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The ID of the session obtained when establishing a session"
},
{
"name": "challenge",
"types": [{ "type": "string", "vector": true }],
"required": true,
"description": "The TOTP based challenge secret"
}
]
},
{
"id": "63843382",
"name": "SessionIdentification",
"description": "A SessionIdentification object allows your client to identify the session it's using and prove that it is the owner of the session, it proves as a identification effort and security effort.",
"parameters": [
{
"name": "id",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The ID of the session obtained when establishing a session"
},
{
"name": "challenge",
"types": [{ "type": "string", "vector": true }],
"required": true,
"description": "The TOTP based challenge secret"
}
]
},
{
"id": "d39428ae",
"name": "TextEntity",
"description": "The text entity object describes the text type, this is useful for clients to render the given text correctly. For example a \"@mention\" will have a TextEntity with the value mention. So that the client can perform an action when this entity is clicked.",
"parameters": [
{
"name": "type",
"types": [{ "type": "string", "vector": false }],
"required": true,
"description": "The text entity type"
},
{
"name": "offset",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The offset for when the entity begins in the text"
},
{
"name": "length",
"types": [{ "type": "integer", "vector": false }],
"required": true,
"description": "The length of the entity"
},
{
"name": "value",
"types": [
{ "type": "string", "vector": false },
{ "type": "null", "vector": false }
],
"required": true,
"description": "The value of the entity, for styling entities such as BOLD, ITALIC, etc. this value will be null, but for values such as MENTION, HASHTAG & URL the value will contain the respective value for the entity, for example a URL entity will contain a value of a http URL"
}
]
}
]
}

View File

@ -1,178 +0,0 @@
{
"validation": {
"8448": {
"_": "InvalidUsername",
"description": "The given username is invalid and does not meet the specification"
},
"8449": {
"_": "InvalidPassword",
"description": "The given password is insecure, see the message for further details"
},
"8450": {
"_": "InvalidFirstName",
"description": "The First Name provided contains invalid characters and or is too long, see the message for further details"
},
"8451": {
"_": "InvalidLastName",
"description": "The Last Name provided contains invalid characters and or is too long, see the message for further details "
},
"8452": {
"_": "InvalidBiography",
"description": "The Biography is too long or contains invalid characters, see the message for further details"
},
"8453": {
"_": "UsernameAlreadyExists",
"description": "The username is already registered in the network and cannot be used "
},
"8454": {
"_": "InvalidPeerInput",
"description": "The client provided an invalid peer identification as input"
},
"8455": {
"_": "InvalidPostText",
"description": "The post contains invalid characters or is too long, see the message for further details"
},
"8456": {
"_": "InvalidClientPublicHash",
"description": "The client's public hash is invalid and cannot be identified as a sha256"
},
"8457": {
"_": "InvalidClientPrivateHash",
"description": "The client's private hash is invalid and cannot be identified as a sha256"
},
"8458": {
"_": "InvalidPlatform",
"description": "The platform name contains invalid characters or is too long, see the message for further details"
},
"8459": {
"_": "InvalidVersion",
"description": "The version is invalid or is too long, see the message for further details"
},
"8460": {
"_": "InvalidClientName",
"description": "The client name contains invalid characters or is too long, see the message for further details"
},
"8461": {
"_": "InvalidSessionIdentification",
"description": "The session identification object is invalid, see the message for further details"
},
"8462": {
"_": "InvalidFileForProfilePicture",
"description": "The given file is invalid for a profile picture"
},
"8463": {
"_": "FileTooLarge",
"description": "The given file is too large to be processed"
},
"8464": {
"_": "InvalidHelpDocumentId",
"description": "The given Help Document ID is invalid"
},
"8465": {
"_": "AgreementRequired",
"description": "The client/user must agree to the condition to invoke the method"
},
"8468": {
"_": "InvalidUrlValue",
"description": "The given URL input is invalid"
}
},
"server": {
"16384": {
"_": "InternalServerError",
"description": "Raised when there was an unexpected error while trying to process your request"
},
"16385": {
"_": "DocumentUpload",
"description": "Raised when there was an error while trying to process the document upload"
}
},
"network": {
"12544": {
"_": "PeerNotFound",
"description": "The requested user entity was not found in the network"
},
"12545": {
"_": "PostNotFound",
"description": "Raised when the client requested a post that isn't found"
},
"12546": {
"_": "PostDeleted",
"description": "Raised when the client requested a post that was deleted"
},
"12547": {
"_": "AlreadyReposted",
"description": "Raised when the client attempts to repost a post that has already been reposted"
},
"12548": {
"_": "FileUploadError",
"description": "Raised when there was an error while trying to upload one or more files to the network"
},
"12549": {
"_": "DocumentNotFound",
"description": "The requested Document ID was not found on the server"
},
"12550": {
"_": "AccessDenied",
"description": "The authenticated peer does not have sufficient permissions to access the requested resource or to invoke a restricted method"
},
"12551": {
"_": "BlockedByPeer",
"description": "Blocked by the peer which attempted to interact with"
},
"12552": {
"_": "BlockedPeer",
"description": "Attempted to interact with a blocked peer"
},
"12553": {
"_": "SelfInteractionNotPermitted",
"description": "Cannot interact with self"
}
},
"authentication": {
"8704": {
"_": "IncorrectLoginCredentials",
"description": "The given login credentials are incorrect"
},
"8705": {
"_": "IncorrectTwoFactorAuthenticationCode",
"description": "The given two-factor authentication code is incorrect"
},
"8706": {
"_": "AuthenticationNotApplicable",
"description": "Raised when the user does not support this method of authentication, see the message for further details"
},
"8707": {
"_": "SessionNotFound",
"description": "Raised when the requested session was not found in the network"
},
"8708": {
"_": "NotAuthenticated",
"description": "Raised when the client attempts to invoke a method that requires authentication"
},
"8709": {
"_": "PrivateAccessTokenRequired",
"description": "Raised when the user/entity uses a Private Access Token to authenticate and the client attempted to authenticate in another way"
},
"8710": {
"_": "AuthenticationFailure",
"description": "The authentication process failed for some unexpected reason, see the message for further details"
},
"8711": {
"_": "BadSessionChallengeAnswer",
"description": "The given session challenge answer is incorrect or out of sync"
},
"8712": {
"_": "TwoFactorAuthenticationRequired",
"description": "Two-Factor Authentication is required, the client must repeat the same request but provide a Two-Factor authentication code as well"
},
"8713": {
"_": "AlreadyAuthenticated",
"description": "The client is attempting to authenticate when already authenticated"
},
"8714": {
"_": "SessionExpired",
"description": "Raised when trying to use a session that has expired"
}
}
}

View File

@ -1,310 +0,0 @@
{
"types": {
"FileType": "\"DOCUMENT\" | \"PHOTO\" | \"VIDEO\" | \"AUDIO\"",
"PeerType": "\"USER\" | \"BOT\" | \"PROXY\"",
"TextEntityType": "\"BOLD\" | \"ITALIC\" | \"CODE\" | \"STRIKE\" | \"UNDERLINE\" | \"URL\" | \"MENTION\" | \"HASHTAG\"",
"PostType": "\"UNKNOWN\" | \"DELETED\" | \"POST\" | \"REPLY\" | \"QUOTE\" | \"REPOST\"",
"RelationshipType": "\"NONE\" | \"FOLLOWING\" | \"FOLLOWS_YOU\" | \"AWAITING_APPROVAL\" | \"MUTUALLY_FOLLOWING\" | \"BLOCKED\" | \"BLOCKED_YOU\""
},
"interfaces": {
"Post": {
"id": {
"type": "string",
"description": "The unique ID for the post"
},
"type": {
"type": "PostType",
"description": "The post type used to represent the true intention of the post"
},
"peer": {
"type": "Peer",
"description": "The author peer of the post, this property can be null if the post was deleted.",
"nullable": true
},
"source": {
"type": "string",
"description": "The source for where this post was composed from or collected from (eg; the client the user is using or the third-party source that the post was collected. This is determined by the server). This property can be null if the post was deleted.",
"nullable": true
},
"text": {
"type": "string",
"description": "The text content of the post source. This property can be null if the post has been deleted",
"nullable": true
},
"entities": {
"type": "TextEntity[]",
"description": "An array of entities extracted from the text, can be used by the client to highlight clickable entities that preforms an action. This property can be null if the post was deleted.",
"nullable": true
},
"mentioned_peers": {
"type": "Peer[]",
"description": "An array of resolved peers that was mentioned in the post text. This property can be null if the post was deleted",
"nullable": true
},
"reply_to_post": {
"type": "Post",
"description": "The original post that this post is replying to if applicable, otherwise null.",
"nullable": true
},
"quoted_post": {
"type": "Post",
"description": "The original post that this post is quoting if applicable, otherwise null",
"nullable": true
},
"reposted_post": {
"type": "Post",
"description": "The original post that this post is reposting if applicable, otherwise null",
"nullable": true
},
"original_thread_post": {
"type": "Post",
"description": "The original thread post, only applicable to replies. This value indicates the main thread post where all the replies originated from. This value will remain the same for all sub-replies of the main post.",
"nullable": true
},
"like_count": {
"type": "number",
"description": "The amount of likes that this post has if applicable, otherwise null",
"nullable": true
},
"repost_count": {
"type": "number",
"description": "The amount of repost that this post has if applicable, otherwise null",
"nullable": true
},
"quote_count": {
"type": "number",
"description": "The amount of replies that this post has if applicable, otherwise null",
"nullable": true
},
"posted_timestamp": {
"type": "number",
"description": "The Unix Timestamp for when this post was created",
"date": true
},
"flags": {
"type": "string[]",
"description": "The flags associated with this post (WIP)"
}
},
"ServerInformation": {
"network_name": {
"type": "string",
"description": "The name of the network, eg; \"Socialvoid\""
},
"protocol_version": {
"type": "string",
"description": "The version of the protocol standard that the server is using, eg; \"1.0\""
},
"cdn_server": {
"type": "string",
"description": "The HTTP URL Endpoint for the CDN server of the network"
},
"upload_max_file_size": {
"type": "number",
"description": "The maximum size of a file that you can upload to the CDN Server (in bytes)"
},
"unauthorized_session_ttl": {
"type": "number",
"description": "The maximum time-to-live (in seconds) that an unauthorized session may have. The server will often reset the expiration whenever the session is used."
},
"authorized_session_ttl": {
"type": "number",
"description": "The maximum time-to-live (in seconds) that an authorized session may have. The server will often reset the expiration whenever the session is used."
},
"retrieve_likes_max_limit": {
"type": "number",
"description": "The maximum amount of likes a client can retrieve at once using the method `timeline.get_likes` via the `limit` parameter"
},
"retrieve_reposts_max_limit": {
"type": "number",
"description": "The maximum amount of reposts a client can retrieve at once using the method `timeline.get_reposted_peers` via the `limit` parameter"
},
"retrieve_replies_max_limit": {
"type": "number",
"description": "The maximum amount of replies a client can retrieve at once using the method `timeline.get_replies` via the `limit` parameter"
},
"retrieve_quotes_max_limit": {
"type": "number",
"description": "The maximum amount of quotes a client can retrieve at once using the method `timeline.get_quotes` via the `limit` parameter"
},
"retrieve_followers_max_limit": {
"type": "number",
"description": "The maximum amount of followers a client can retrieve at once using the method `network.get_followers` via the `limit` parameter"
},
"retrieve_following_max_limit": {
"type": "number",
"description": "The maximum amount of following peers a client can retrieve at once using the method `network.get_following` via the `limit` parameter"
}
},
"Peer": {
"id": {
"type": "string",
"description": "The ID of the user associated to the network"
},
"type": {
"type": "PeerType",
"description": "The type of the peer entity"
},
"name": {
"type": "string",
"description": "The display name of the peer"
},
"username": {
"type": "string",
"description": "The username associated with this peer"
},
"flags": {
"type": "string[]",
"description": "Flags associated with this peer"
}
},
"Session": {
"id": {
"type": "string",
"description": "The ID of the session obtained when establishing a session"
},
"flags": {
"type": "string[]",
"description": "An array of flags that has been set to this session"
},
"authenticated": {
"type": "boolean",
"description": "Indicates if the session is currently authenticated to a user"
},
"created": {
"type": "number",
"description": "The Unix Timestamp for when this session was first created",
"date": true
},
"expires": {
"type": "number",
"description": "The Unix Timestamp for when this session expires",
"date": true
}
},
"Document": {
"id": { "type": "string", "description": "The ID of the document" },
"file_mime": { "type": "string", "description": "The Mime of the file" },
"file_name": {
"type": "string",
"description": "The original name of the file"
},
"file_size": {
"type": "number",
"description": "The size of the file in bytes"
},
"file_type": {
"type": "FileType",
"description": "The type of file detected by the server"
},
"flags": {
"type": "string[]",
"description": "An array of flags associated with this document"
}
},
"HelpDocument": {
"id": {
"type": "string",
"description": "The ID of the document, if the document gets updated then the ID will change."
},
"text": {
"type": "string",
"description": "The text contents of the document"
},
"entities": {
"type": "TextEntity[]",
"description": "An array of text entities being represented in the text"
}
},
"DisplayPictureSize": {
"width": { "type": "number", "description": "The width of the image" },
"height": { "type": "number", "description": "The height of the image" },
"document": {
"type": "Document",
"description": "The document object that points to the display picture"
}
},
"Profile": {
"first_name": {
"type": "string",
"description": "The first name of the entity"
},
"last_name": {
"type": "string",
"description": "The last name of the entity",
"nullable": true
},
"name": {
"type": "string",
"description": "The full display name of the entity"
},
"biography": {
"type": "string",
"description": "A biography or description of the entity",
"nullable": true
},
"location": {
"type": "string",
"description": "The location of the entity",
"nullable": true
},
"url": {
"type": "string",
"description": "The URL of the entity (Can be a website or a blog, etc)",
"nullable": true
},
"followers_count": {
"type": "number",
"description": "The amount of followers that this entity has"
},
"following_count": {
"type": "number",
"description": "The amount of peers that this entity is following"
},
"display_picture_sizes": {
"type": "DisplayPictureSize[]",
"description": "An array of display picture size objects that represents the entity's display picture"
}
},
"SessionIdentification": {
"session_id": {
"type": "string",
"description": "The ID of the session obtained when establishing a session"
},
"client_public_hash": {
"type": "string",
"description": "The Public Hash of the client used when establishing the session"
},
"challenge_answer": {
"type": "string",
"description": "The session challenge answer revolving around the client's private hash, the same client used to establish the session"
}
},
"SessionEstablished": {
"id": {
"type": "string",
"description": "The ID of the session obtained when establishing a session"
},
"challenge": {
"type": "string",
"description": "The TOTP based challenge secret"
}
},
"TextEntity": {
"type": {
"type": "TextEntityType",
"description": "The text entity type"
},
"offset": {
"type": "number",
"description": "The offset for when the entity begins in the text"
},
"length": { "type": "number", "description": "The length of the entity" },
"value": {
"type": "string",
"description": "The value of the entity, for styling entities such as `BOLD | ITALIC`, etc. this value will be null, but for values such as `MENTION | HASHTAG` & `URL` the value will contain the respective value for the entity, for example a `URL` entity will contain a value of a http URL",
"nullable": true
}
}
}
}

View File

@ -1,6 +0,0 @@
export const format = () =>
Deno.run({
cmd: ["deno", "fmt", "--config", "deno.json"],
cwd: "../",
stdout: "piped",
}).output();

85
generators/generate.ts Normal file
View File

@ -0,0 +1,85 @@
import { format } from "./utils.ts";
interface SocialvoidError {
id: string;
name: string;
description: string;
error_code: number;
}
interface SocialvoidType {
id: string;
name: string;
description: string;
parameters: {
name: string;
types: { type: string; vector: boolean }[];
required: boolean;
description: string;
}[];
}
const { errors, objects: types }: {
errors: SocialvoidError[];
objects: SocialvoidType[];
} = JSON.parse(await Deno.readTextFile("data.json"));
//
let errs = "";
errs += `export class SocialvoidError extends Error {
message: string;
constructor(public errorCode: number, public errorMessage: string) {
super();
this.message = \`Error \${errorCode}: \${errorMessage}\`;
}
}\n\n`;
for (const err of errors) {
errs += `// ${err.description}\n`;
errs += `export class ${err.name} extends SocialvoidError {}\n\n`;
}
errs += "const map: {[key: string]: typeof SocialvoidError} = {";
for (const err of errors) {
errs += `"${err.error_code}": ${err.name},`;
}
errs += "};\n\n";
errs += "export default map";
//
let typs = "";
for (const typ of types) {
typs += `// ${typ.description}\n`;
typs += `export interface ${typ.name} {\n`;
for (const param of typ.parameters) {
typs += `// ${param.description}\n`;
typs += `${param.name}`;
if (!param.required) {
typs += "?";
}
typs += ": ";
typs += param.types.map((param) =>
param.type == "integer" ? "number" : param.type + (param.vector ? "[]" : "")
).join(" | ");
typs += ";\n";
}
typs += "}\n\n";
}
//
await Deno.writeTextFile("../socialvoid/errors.ts", errs);
await Deno.writeTextFile("../socialvoid/types.ts", typs);
await format();

View File

@ -1,56 +0,0 @@
import { format } from "./format.ts";
interface Error {
_: string;
description: string;
}
type ErrorGroup = { [key: string]: Error };
type ErrorGroups = { [key: string]: ErrorGroup };
const errorGroups: ErrorGroups = JSON.parse(
Deno.readTextFileSync("./data/errors.json"),
);
let map: { [key: string]: string } = {};
let toWrite = `
export class SocialvoidError extends Error {
message: string;
constructor(public errorCode: number, public errorMessage: string) {
super();
this.message = \`Error \${errorCode}: \${errorMessage}\`;
}
}
`;
for (const i in errorGroups) {
const name = i.charAt(0).toUpperCase() + i.slice(1) + "Error";
const errorGroup = errorGroups[i];
toWrite += `
export class ${name} extends SocialvoidError {}
`;
for (const i in errorGroup) {
const code = i;
const type = errorGroup[code]._;
map[code] = type;
toWrite += `export class ${type} extends ${name} {}\n\n`;
}
}
toWrite += "const map: {[key: string]: typeof SocialvoidError} = ";
toWrite += JSON.stringify(map)
.replaceAll('":"', '":')
.replaceAll('",', ",")
.replace('"}', "}");
toWrite += ";\n\n";
toWrite += "export default map;";
await Deno.writeTextFile("../socialvoid/errors.ts", toWrite);
await format();

View File

@ -1,51 +0,0 @@
import { toCamel } from "./helpers.ts";
import { format } from "./format.ts";
interface TypeParams {
type: string;
description: string;
date?: boolean;
nullable?: boolean;
}
type Type = { [key: string]: TypeParams };
type Types = {
types: { [key: string]: string };
interfaces: { [key: string]: Type };
};
const types: Types = JSON.parse(
Deno.readTextFileSync("./data/types.json"),
);
let code = ``;
for (const name in types.types) {
const type = types.types[name];
code += `export type ${name} = ${type};\n\n`;
}
for (const name in types.interfaces) {
const params = types.interfaces[name];
code += `export interface ${name} {`;
for (const name in params) {
const param = params[name];
code += `\n/** ${param.description} */\n`;
code += `${name}: ${param.type}`;
if (param.nullable) {
code += " | null";
}
code += ";";
}
code += "}\n\n";
}
await Deno.writeTextFile("../socialvoid/types.ts", code);
await format();

View File

@ -1,5 +0,0 @@
export const toCamel = (s: string) => {
return s.replace(/([-_][a-z])/gi, ($1) => {
return $1.toUpperCase().replace("-", "").replace("_", "");
});
};

View File

@ -1,2 +1 @@
import "./generateErrors.ts";
import "./generateTypes.ts";
import "./generate.ts";

13
generators/utils.ts Normal file
View File

@ -0,0 +1,13 @@
export const toCamel = (s: string) => {
return s.replace(/([-_][a-z])/gi, ($1) => {
return $1.toUpperCase().replace("-", "").replace("_", "");
});
};
export const format = async () => {
await Deno.run({
cmd: ["deno", "fmt", "--config", "deno.json"],
cwd: "../",
stdout: "piped",
}).output();
};

View File

@ -7,141 +7,191 @@ export class SocialvoidError extends Error {
}
}
export class ValidationError extends SocialvoidError {}
// The client is attempting to authenticate when already authenticated
export class AlreadyAuthenticated extends SocialvoidError {}
export class InvalidUsername extends ValidationError {}
// The authentication process failed for some unexpected reason, see the message for further details
export class AuthenticationFailure extends SocialvoidError {}
export class InvalidPassword extends ValidationError {}
// Raised when the user does not support this method of authentication, see the message for further details
export class AuthenticationNotApplicable extends SocialvoidError {}
export class InvalidFirstName extends ValidationError {}
// The given session challenge answer is incorrect or out of sync
export class BadSessionChallengeAnswer extends SocialvoidError {}
export class InvalidLastName extends ValidationError {}
// The given login credentials are incorrect
export class IncorrectLoginCredentials extends SocialvoidError {}
export class InvalidBiography extends ValidationError {}
// The given two-factor authentication code is incorrect
export class IncorrectTwoFactorAuthenticationCode extends SocialvoidError {}
export class UsernameAlreadyExists extends ValidationError {}
// Raised when the client attempts to invoke a method that requires authentication
export class NotAuthenticated extends SocialvoidError {}
export class InvalidPeerInput extends ValidationError {}
// Raised when the user/entity uses a Private Access Token to authenticate and the client attempted to authenticate in another way
export class PrivateAccessTokenRequired extends SocialvoidError {}
export class InvalidPostText extends ValidationError {}
// Raised when trying to use a session that has expired
export class SessionExpired extends SocialvoidError {}
export class InvalidClientPublicHash extends ValidationError {}
// Two-Factor Authentication is required, the client must repeat the same request but provide a Two-Factor authentication code as well
export class TwoFactorAuthenticationRequired extends SocialvoidError {}
export class InvalidClientPrivateHash extends ValidationError {}
// The authenticated peer does not have sufficient permissions to access the requested resource or to invoke a restricted method
export class AccessDenied extends SocialvoidError {}
export class InvalidPlatform extends ValidationError {}
// Raised when the client attempts to repost a post that has already been reposted
export class AlreadyReposted extends SocialvoidError {}
export class InvalidVersion extends ValidationError {}
// Raised when attempting to interact with a peer that blocked you
export class BlockedByPeer extends SocialvoidError {}
export class InvalidClientName extends ValidationError {}
// Raised when attempting to interact with a peer that you blocked
export class BlockedPeer extends SocialvoidError {}
export class InvalidSessionIdentification extends ValidationError {}
// The requested Document ID was not found on the server
export class DocumentNotFound extends SocialvoidError {}
export class InvalidFileForProfilePicture extends ValidationError {}
// Raised when there was an error while trying to upload one or more files to the network
export class FileUploadError extends SocialvoidError {}
export class FileTooLarge extends ValidationError {}
// The requested user entity was not found in the network
export class PeerNotFound extends SocialvoidError {}
export class InvalidHelpDocumentId extends ValidationError {}
// Raised when the client requested a post that was deleted
export class PostDeleted extends SocialvoidError {}
export class AgreementRequired extends ValidationError {}
// Raised when the client requested a post that isn't found
export class PostNotFound extends SocialvoidError {}
export class InvalidUrlValue extends ValidationError {}
// Raised when attempting to invoke a method or change that involves a peer that you are authenticated as such as following a peer that you are authenticated as
export class SelfInteractionNotPermitted extends SocialvoidError {}
export class ServerError extends SocialvoidError {}
// Raised when there was an error while trying to process the document upload
export class DocumentUpload extends SocialvoidError {}
export class InternalServerError extends ServerError {}
// Raised when there was an unexpected error while trying to process your request.
export class InternalServerError extends SocialvoidError {}
export class DocumentUpload extends ServerError {}
// The client/user must agree to the condition to invoke the method
export class AgreementRequired extends SocialvoidError {}
export class NetworkError extends SocialvoidError {}
// The given file is too large to be processed
export class FileTooLarge extends SocialvoidError {}
export class PeerNotFound extends NetworkError {}
// Raised when the given attachments are invalid
export class InvalidAttachments extends SocialvoidError {}
export class PostNotFound extends NetworkError {}
// The Biography is too long or contains invalid characters, see the message for further details
export class InvalidBiography extends SocialvoidError {}
export class PostDeleted extends NetworkError {}
// The client name contains invalid characters or is too long, see the message for further details
export class InvalidClientName extends SocialvoidError {}
export class AlreadyReposted extends NetworkError {}
// The client's private hash is invalid and cannot be identified as a sha256
export class InvalidClientPrivateHash extends SocialvoidError {}
export class FileUploadError extends NetworkError {}
// The client's public hash is invalid and cannot be identified as a sha256
export class InvalidClientPublicHash extends SocialvoidError {}
export class DocumentNotFound extends NetworkError {}
// The given file is invalid for a profile picture
export class InvalidFileForProfilePicture extends SocialvoidError {}
export class AccessDenied extends NetworkError {}
// Raised when the given filename is invalid
export class InvalidFileName extends SocialvoidError {}
export class BlockedByPeer extends NetworkError {}
// Raised when the given filename is invalid
export class InvalidFileName extends SocialvoidError {}
export class BlockedPeer extends NetworkError {}
// The given geo location value is invalid or too long
export class InvalidGeoLocation extends SocialvoidError {}
export class SelfInteractionNotPermitted extends NetworkError {}
// The given Help Document ID is invalid
export class InvalidHelpDocumentId extends SocialvoidError {}
export class AuthenticationError extends SocialvoidError {}
// The Last Name provided contains invalid characters and or is too long, see the message for further details
export class InvalidLastName extends SocialvoidError {}
export class IncorrectLoginCredentials extends AuthenticationError {}
// The page parameter contains an invalid value. It cannot be a negative value or 0, see the message for further details
export class InvalidPageValue extends SocialvoidError {}
export class IncorrectTwoFactorAuthenticationCode extends AuthenticationError {}
// The given password is insecure, see the message for further details
export class InvalidPassword extends SocialvoidError {}
export class AuthenticationNotApplicable extends AuthenticationError {}
// The client provided an invalid peer identification as input
export class InvalidPeerInput extends SocialvoidError {}
export class SessionNotFound extends AuthenticationError {}
// The platform name contains invalid characters or is too long, see the message for further details
export class InvalidPlatform extends SocialvoidError {}
export class NotAuthenticated extends AuthenticationError {}
// The post contains invalid characters or is too long, see the message for further details
export class InvalidPostText extends SocialvoidError {}
export class PrivateAccessTokenRequired extends AuthenticationError {}
// The session identification object is invalid, see the message for further details
export class InvalidSessionIdentification extends SocialvoidError {}
export class AuthenticationFailure extends AuthenticationError {}
// The given URL input is invalid
export class InvalidUrlValue extends SocialvoidError {}
export class BadSessionChallengeAnswer extends AuthenticationError {}
// The given username is invalid and does not meet the specification
export class InvalidUsername extends SocialvoidError {}
export class TwoFactorAuthenticationRequired extends AuthenticationError {}
// The version is invalid or is too long, see the message for further details
export class InvalidVersion extends SocialvoidError {}
export class AlreadyAuthenticated extends AuthenticationError {}
// Raised when the amount of attachments exceeds what the server supports
export class TooManyAttachments extends SocialvoidError {}
export class SessionExpired extends AuthenticationError {}
// The username is already registered in the network and cannot be used
export class UsernameAlreadyExists extends SocialvoidError {}
const map: { [key: string]: typeof SocialvoidError } = {
"8448": InvalidUsername,
"8449": InvalidPassword,
"8450": InvalidFirstName,
"8451": InvalidLastName,
"8452": InvalidBiography,
"8453": UsernameAlreadyExists,
"8454": InvalidPeerInput,
"8455": InvalidPostText,
"8456": InvalidClientPublicHash,
"8457": InvalidClientPrivateHash,
"8458": InvalidPlatform,
"8459": InvalidVersion,
"8460": InvalidClientName,
"8461": InvalidSessionIdentification,
"8462": InvalidFileForProfilePicture,
"8463": FileTooLarge,
"8464": InvalidHelpDocumentId,
"8465": AgreementRequired,
"8468": InvalidUrlValue,
"8713": AlreadyAuthenticated,
"8710": AuthenticationFailure,
"8706": AuthenticationNotApplicable,
"8711": BadSessionChallengeAnswer,
"8704": IncorrectLoginCredentials,
"8705": IncorrectTwoFactorAuthenticationCode,
"8706": AuthenticationNotApplicable,
"8707": SessionNotFound,
"8708": NotAuthenticated,
"8709": PrivateAccessTokenRequired,
"8710": AuthenticationFailure,
"8711": BadSessionChallengeAnswer,
"8712": TwoFactorAuthenticationRequired,
"8713": AlreadyAuthenticated,
"8714": SessionExpired,
"12544": PeerNotFound,
"12545": PostNotFound,
"12546": PostDeleted,
"12547": AlreadyReposted,
"12548": FileUploadError,
"12549": DocumentNotFound,
"8712": TwoFactorAuthenticationRequired,
"12550": AccessDenied,
"12547": AlreadyReposted,
"12551": BlockedByPeer,
"12552": BlockedPeer,
"12549": DocumentNotFound,
"12548": FileUploadError,
"12544": PeerNotFound,
"12546": PostDeleted,
"12545": PostNotFound,
"12553": SelfInteractionNotPermitted,
"16384": InternalServerError,
"16385": DocumentUpload,
"16384": InternalServerError,
"8465": AgreementRequired,
"8463": FileTooLarge,
"8470": InvalidAttachments,
"8452": InvalidBiography,
"8460": InvalidClientName,
"8457": InvalidClientPrivateHash,
"8456": InvalidClientPublicHash,
"8462": InvalidFileForProfilePicture,
"8471": InvalidFileName,
"8471": InvalidFileName,
"8467": InvalidGeoLocation,
"8464": InvalidHelpDocumentId,
"8451": InvalidLastName,
"8466": InvalidPageValue,
"8449": InvalidPassword,
"8454": InvalidPeerInput,
"8464": InvalidPlatform,
"8455": InvalidPostText,
"8461": InvalidSessionIdentification,
"8468": InvalidUrlValue,
"8448": InvalidUsername,
"8459": InvalidVersion,
"8469": TooManyAttachments,
"8453": UsernameAlreadyExists,
};
export default map;

View File

@ -1,193 +1,183 @@
export type FileType = "DOCUMENT" | "PHOTO" | "VIDEO" | "AUDIO";
export type PeerType = "USER" | "BOT" | "PROXY";
export type TextEntityType =
| "BOLD"
| "ITALIC"
| "CODE"
| "STRIKE"
| "UNDERLINE"
| "URL"
| "MENTION"
| "HASHTAG";
export type PostType = "UNKNOWN" | "DELETED" | "POST" | "REPLY" | "QUOTE" | "REPOST";
export type RelationshipType =
| "NONE"
| "FOLLOWING"
| "FOLLOWS_YOU"
| "AWAITING_APPROVAL"
| "MUTUALLY_FOLLOWING"
| "BLOCKED"
| "BLOCKED_YOU";
export interface Post {
/** The unique ID for the post */
id: string;
/** The post type used to represent the true intention of the post */
type: PostType;
/** The author peer of the post, this property can be null if the post was deleted. */
peer: Peer | null;
/** The source for where this post was composed from or collected from (eg; the client the user is using or the third-party source that the post was collected. This is determined by the server). This property can be null if the post was deleted. */
source: string | null;
/** The text content of the post source. This property can be null if the post has been deleted */
text: string | null;
/** An array of entities extracted from the text, can be used by the client to highlight clickable entities that preforms an action. This property can be null if the post was deleted. */
entities: TextEntity[] | null;
/** An array of resolved peers that was mentioned in the post text. This property can be null if the post was deleted */
mentioned_peers: Peer[] | null;
/** The original post that this post is replying to if applicable, otherwise null. */
reply_to_post: Post | null;
/** The original post that this post is quoting if applicable, otherwise null */
quoted_post: Post | null;
/** The original post that this post is reposting if applicable, otherwise null */
reposted_post: Post | null;
/** The original thread post, only applicable to replies. This value indicates the main thread post where all the replies originated from. This value will remain the same for all sub-replies of the main post. */
original_thread_post: Post | null;
/** The amount of likes that this post has if applicable, otherwise null */
like_count: number | null;
/** The amount of repost that this post has if applicable, otherwise null */
repost_count: number | null;
/** The amount of replies that this post has if applicable, otherwise null */
quote_count: number | null;
/** The Unix Timestamp for when this post was created */
posted_timestamp: number;
/** The flags associated with this post (WIP) */
flags: string[];
}
export interface ServerInformation {
/** The name of the network, eg; "Socialvoid" */
network_name: string;
/** The version of the protocol standard that the server is using, eg; "1.0" */
protocol_version: string;
/** The HTTP URL Endpoint for the CDN server of the network */
cdn_server: string;
/** The maximum size of a file that you can upload to the CDN Server (in bytes) */
upload_max_file_size: number;
/** The maximum time-to-live (in seconds) that an unauthorized session may have. The server will often reset the expiration whenever the session is used. */
unauthorized_session_ttl: number;
/** The maximum time-to-live (in seconds) that an authorized session may have. The server will often reset the expiration whenever the session is used. */
authorized_session_ttl: number;
/** The maximum amount of likes a client can retrieve at once using the method `timeline.get_likes` via the `limit` parameter */
retrieve_likes_max_limit: number;
/** The maximum amount of reposts a client can retrieve at once using the method `timeline.get_reposted_peers` via the `limit` parameter */
retrieve_reposts_max_limit: number;
/** The maximum amount of replies a client can retrieve at once using the method `timeline.get_replies` via the `limit` parameter */
retrieve_replies_max_limit: number;
/** The maximum amount of quotes a client can retrieve at once using the method `timeline.get_quotes` via the `limit` parameter */
retrieve_quotes_max_limit: number;
/** The maximum amount of followers a client can retrieve at once using the method `network.get_followers` via the `limit` parameter */
retrieve_followers_max_limit: number;
/** The maximum amount of following peers a client can retrieve at once using the method `network.get_following` via the `limit` parameter */
retrieve_following_max_limit: number;
}
export interface Peer {
/** The ID of the user associated to the network */
id: string;
/** The type of the peer entity */
type: PeerType;
/** The display name of the peer */
name: string;
/** The username associated with this peer */
username: string;
/** Flags associated with this peer */
flags: string[];
}
export interface Session {
/** The ID of the session obtained when establishing a session */
id: string;
/** An array of flags that has been set to this session */
flags: string[];
/** Indicates if the session is currently authenticated to a user */
authenticated: boolean;
/** The Unix Timestamp for when this session was first created */
created: number;
/** The Unix Timestamp for when this session expires */
expires: number;
}
export interface Document {
/** The ID of the document */
id: string;
/** The Mime of the file */
file_mime: string;
/** The original name of the file */
file_name: string;
/** The size of the file in bytes */
file_size: number;
/** The type of file detected by the server */
file_type: FileType;
/** An array of flags associated with this document */
flags: string[];
}
export interface HelpDocument {
/** The ID of the document, if the document gets updated then the ID will change. */
id: string;
/** The text contents of the document */
text: string;
/** An array of text entities being represented in the text */
entities: TextEntity[];
}
// This object describes the size of a display picture followed by a document object that results in said display picture size.
export interface DisplayPictureSize {
/** The width of the image */
// The width of the image
width: number;
/** The height of the image */
// The height of the image
height: number;
/** The document object that points to the display picture */
// The document object that points to the display picture
document: Document;
}
export interface Profile {
/** The first name of the entity */
first_name: string;
/** The last name of the entity */
last_name: string | null;
/** The full display name of the entity */
// A document object contains basic information about the file associated with the document and the document ID used to retrieve the document from the CDN Server
export interface Document {
// The ID of the document
id: string;
// The Mime of the file
file_mime: string;
// The original name of the file
file_name: string;
// The size of the file in bytes
file_size: number;
// The type of file detected by the server
file_type: string;
// An array of flags associated with this document
flags: string[];
}
// A help document is often retrieved from the server as a way to represent a document to the user for multiple purposes, from quick guides to server announcements or the legal documents required to be shown to the user before they register an account to the network.
export interface HelpDocument {
// The ID of the document, if the document gets updated then the ID will change
id: string;
// The text contents of the document
text: string;
// An array of text entities being represented in the text
entities: TextEntity[];
}
// A peer object provides a basic description and identification a peer entity that can contain information used to identify a peer on the client or basic flags and properties of the peer to pre-determine what actions are available for a peer.
export interface Peer {
// The ID of the document, if the document gets updated then the ID will change
id: string;
// The type of the peer entity
type: string;
// The display name of the peer
name: string;
/** A biography or description of the entity */
// The username associated with this peer
username: string;
// Flags associated with this peer
flags: string[];
}
// A post object is used to represent a post submitted either by a peer, this object can contain recursive objects.
export interface Post {
// The unique ID for the post
id: string;
// The post type used to represent the true intention of the post
type: string;
// The author peer of the post, this property can be null if the post was deleted.
peer: Peer | null;
// The source for where this post was composed from or collected from (eg; the client the user is using or the third-party source that the post was collected. This is determined by the server). This property can be null if the post was deleted.
source: string | null;
// The text content of the post source. This property can be null if the post has been deleted
text: string | null;
// An array of attached documents to the post
attachments: Document[];
// An array of entities extracted from the text, can be used by the client to highlight clickable entities that preforms an action.
entities: TextEntity[];
// An array of resolved peers that was mentioned in the post text.
mentioned_peers: Peer[];
// The original post that this post is replying to if applicable, otherwise null.
reply_to_post: Post | null;
// The original post that this post is quoting if applicable, otherwise null
quoted_post: Post | null;
// The original post that this post is reposting if applicable, otherwise null
reposted_post: Post | null;
// The original thread post, only applicable to replies. This value indicates the main thread post where all the replies originated from. This value will remain the same for all sub-replies of the main post.
original_thread_post: Post | null;
// The amount of likes that this post has if applicable, otherwise null
like_count: number | null;
// The amount of repost that this post has if applicable, otherwise null
repost_count: number | null;
// The amount of quoted posts that this post has if applicable, otherwise null
quote_count: number | null;
// The amount of replies that this post has if applicable, otherwise null
reply_count: number | null;
// The Unix Timestamp for when this post was created
posted_timestamp: number;
// The flags associated with this post
flags: string[];
}
// The profile object provides a profile display for a peer entity, this is mainly used to represent a "Profile" display of a peer.
export interface Profile {
// The first name of the entity
first_name: string;
// The last name of the entity
last_name: string | null;
// The full display name of the entity
name: string;
// A biography or description of the entity
biography: string | null;
/** The location of the entity */
// The location of the entity
location: string | null;
/** The URL of the entity (Can be a website or a blog, etc) */
// The URL of the entity (Can be a website or a blog, etc)
url: string | null;
/** The amount of followers that this entity has */
// The amount of followers that this entity has
followers_count: number;
/** The amount of peers that this entity is following */
// The amount of peers that this entity is following
following_count: number;
/** An array of display picture size objects that represents the entity's display picture */
// An array of display picture size objects that represents the entity's display picture
display_picture_sizes: DisplayPictureSize[];
}
export interface SessionIdentification {
/** The ID of the session obtained when establishing a session */
session_id: string;
/** The Public Hash of the client used when establishing the session */
client_public_hash: string;
/** The session challenge answer revolving around the client's private hash, the same client used to establish the session */
challenge_answer: string;
// The ServerInformation object is a simple object that gives details about the server's attributes and limits or location of other servers that the client should communicate to for other purposes such as a CDN.
export interface ServerInformation {
// The name of the network, eg; "Socialvoid"
network_name: string;
// The version of the protocol standard that the server is using, eg; "1.0"
protocol_version: string;
// The HTTP URL Endpoint for the CDN server of the network
cdn_server: string;
// The maximum size of a file that you can upload to the CDN Server (in bytes)
upload_max_file_size: number;
// The maximum time-to-live (in seconds) that an unauthorized session may have. The server will often reset the expiration whenever the session is used.
unauthorized_session_ttl: number;
// The maximum time-to-live (in seconds) that an authorized session may have. The server will often reset the expiration whenever the session is used.
authorized_session_ttl: number;
// The maximum amount of likes a client can retrieve at once using the method timeline.get_likes via the page parameter
retrieve_likes_max_limit: number;
// The maximum amount of reposts a client can retrieve at once using the method timeline.get_reposted_peers via the page parameter
retrieve_reposts_max_limit: number;
// The maximum amount of replies a client can retrieve at once using the method timeline.get_replies via the page parameter
retrieve_replies_max_limit: number;
// The maximum amount of quotes a client can retrieve at once using the method timeline.get_quotes via the page parameter
retrieve_quotes_max_limit: number;
// The maximum amount of followers a client can retrieve at once using the method network.get_followers via the page parameter
retrieve_followers_max_limit: number;
// The maximum amount of following peers a client can retrieve at once using the method network.get_following via the page parameter
retrieve_following_max_limit: number;
// The amount of posts a client can retrieve at once using the method timeline.retrieve_feed via the page parameter
retrieve_feed_max_limit: number;
}
export interface SessionEstablished {
/** The ID of the session obtained when establishing a session */
// A session object is contains basic information about the session.
export interface Session {
// The ID of the session obtained when establishing a session
id: string;
/** The TOTP based challenge secret */
challenge: string;
// An array of flags that has been set to this session
flags: string[];
// Indicates if the session is currently authenticated to a user
authenticated: boolean;
// The Unix Timestamp for when this session was first created
created: number;
// The Unix Timestamp for when this session expires
expires: number;
}
// A SessionEstablished object is returned when you create a session. This object returns basic information about the session that the server has created for you.
export interface SessionEstablished {
// The ID of the session obtained when establishing a session
id: string;
// The TOTP based challenge secret
challenge: string[];
}
// A SessionIdentification object allows your client to identify the session it's using and prove that it is the owner of the session, it proves as a identification effort and security effort.
export interface SessionIdentification {
// The ID of the session obtained when establishing a session
id: string;
// The TOTP based challenge secret
challenge: string[];
}
// The text entity object describes the text type, this is useful for clients to render the given text correctly. For example a "@mention" will have a TextEntity with the value mention. So that the client can perform an action when this entity is clicked.
export interface TextEntity {
/** The text entity type */
type: TextEntityType;
/** The offset for when the entity begins in the text */
// The text entity type
type: string;
// The offset for when the entity begins in the text
offset: number;
/** The length of the entity */
// The length of the entity
length: number;
/** The value of the entity, for styling entities such as `BOLD | ITALIC`, etc. this value will be null, but for values such as `MENTION | HASHTAG` & `URL` the value will contain the respective value for the entity, for example a `URL` entity will contain a value of a http URL */
// The value of the entity, for styling entities such as BOLD, ITALIC, etc. this value will be null, but for values such as MENTION, HASHTAG & URL the value will contain the respective value for the entity, for example a URL entity will contain a value of a http URL
value: string | null;
}