From 0e0c3e28b57a61816c71184c4f54b2266f631883 Mon Sep 17 00:00:00 2001 From: jiangpengfei Date: Sun, 20 Oct 2024 14:48:43 +0800 Subject: [PATCH 1/2] fix(hover): fix hover markdown syntax --- lsp/hover.go | 12 +++++++++++- tests/evernote-thrift/src/test.thrift | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/evernote-thrift/src/test.thrift diff --git a/lsp/hover.go b/lsp/hover.go index 90ed9e5..fb163a1 100644 --- a/lsp/hover.go +++ b/lsp/hover.go @@ -2,6 +2,7 @@ package lsp import ( "context" + "strings" "github.com/joyme123/thrift-ls/lsp/codejump" "go.lsp.dev/protocol" @@ -25,10 +26,19 @@ func (s *Server) hover(ctx context.Context, params *protocol.HoverParams) (*prot return nil, nil } + markdown_prefix := "```thrift\n" + if strings.HasPrefix(content, "\n") { + markdown_prefix = "```thrift" + } + markdown_suffix := "\n```" + if strings.HasSuffix(content, "\n") { + markdown_suffix = "```" + } + return &protocol.Hover{ Contents: protocol.MarkupContent{ Kind: protocol.Markdown, - Value: "```thrift\n" + content + "```", + Value: markdown_prefix + content + markdown_suffix, }, }, nil } diff --git a/tests/evernote-thrift/src/test.thrift b/tests/evernote-thrift/src/test.thrift new file mode 100644 index 0000000..3e23c9c --- /dev/null +++ b/tests/evernote-thrift/src/test.thrift @@ -0,0 +1,4 @@ +struct A {} +struct B { + 1: A str, +} -- 2.51.2 From f6715b8ccaa31a64e4951899d21892f068ea9acd Mon Sep 17 00:00:00 2001 From: jiangpengfei Date: Tue, 22 Oct 2024 14:01:28 +0800 Subject: [PATCH 2/2] fix(format): add addtional line between definition --- format/document.go | 4 + format/document_test.go | 1 + tests/evernote-thrift/src/UserStore.thrift | 929 ++++++++++----------- tests/evernote-thrift/src/test.thrift | 15 + 4 files changed, 461 insertions(+), 488 deletions(-) diff --git a/format/document.go b/format/document.go index d7beaa9..59fff28 100644 --- a/format/document.go +++ b/format/document.go @@ -29,6 +29,10 @@ func FormatDocumentWithValidation(doc *parser.Document, selfValidation bool) (st writeBuf := func(node parser.Node, addtionalLine bool) { if addtionalLine { + if len(buf.Bytes()) > 0 && buf.Bytes()[buf.Len()-1] != '\n' { + // if preNode doesn't have \n at end of line, set \n for it + buf.WriteString("\n") + } buf.WriteString("\n") } diff --git a/format/document_test.go b/format/document_test.go index 820f6e5..5be9c99 100644 --- a/format/document_test.go +++ b/format/document_test.go @@ -165,6 +165,7 @@ exception Xception2 { } struct EmptyStruct {} + struct OneField { 1: EmptyStruct field } diff --git a/tests/evernote-thrift/src/UserStore.thrift b/tests/evernote-thrift/src/UserStore.thrift index e7dea02..2433fca 100644 --- a/tests/evernote-thrift/src/UserStore.thrift +++ b/tests/evernote-thrift/src/UserStore.thrift @@ -42,14 +42,12 @@ namespace cocoa EDAM namespace perl EDAMUserStore namespace go edam - /** * The major version number for the current revision of the EDAM protocol. * Clients pass this to the service using UserStore.checkVersion at the * beginning of a session to confirm that they are not out of date. */ const i16 EDAM_VERSION_MAJOR = 1 - /** * The minor version number for the current revision of the EDAM protocol. * Clients pass this to the service using UserStore.checkVersion at the @@ -91,11 +89,11 @@ const i16 EDAM_VERSION_MINOR = 28 * */ struct PublicUserInfo { - 1: required Types.UserID userId, - 7: optional Types.ServiceLevel serviceLevel, - 4: optional string username, - 5: optional string noteStoreUrl, - 6: optional string webApiUrlPrefix + 1: required Types.UserID userId, + 7: optional Types.ServiceLevel serviceLevel, + 4: optional string username, + 5: optional string noteStoreUrl, + 6: optional string webApiUrlPrefix } /** @@ -146,12 +144,12 @@ struct PublicUserInfo { * */ struct UserUrls { - 1: optional string noteStoreUrl, - 2: optional string webApiUrlPrefix, - 3: optional string userStoreUrl, - 4: optional string utilityUrl, - 5: optional string messageStoreUrl, - 6: optional string userWebSocketUrl + 1: optional string noteStoreUrl, + 2: optional string webApiUrlPrefix, + 3: optional string userStoreUrl, + 4: optional string utilityUrl, + 5: optional string messageStoreUrl, + 6: optional string userWebSocketUrl } /** @@ -219,16 +217,16 @@ struct UserUrls { * */ struct AuthenticationResult { - 1: required Types.Timestamp currentTime, - 2: required string authenticationToken, - 3: required Types.Timestamp expiration, - 4: optional Types.User user, - 5: optional PublicUserInfo publicUserInfo, - 6: optional string noteStoreUrl, - 7: optional string webApiUrlPrefix, - 8: optional bool secondFactorRequired, - 9: optional string secondFactorDeliveryHint, - 10: optional UserUrls urls + 1: required Types.Timestamp currentTime, + 2: required string authenticationToken, + 3: required Types.Timestamp expiration, + 4: optional Types.User user, + 5: optional PublicUserInfo publicUserInfo, + 6: optional string noteStoreUrl, + 7: optional string webApiUrlPrefix, + 8: optional bool secondFactorRequired, + 9: optional string secondFactorDeliveryHint, + 10: optional UserUrls urls } /** @@ -295,20 +293,20 @@ struct AuthenticationResult { * */ struct BootstrapSettings { - 1: required string serviceHost, - 2: required string marketingUrl, - 3: required string supportUrl, - 4: required string accountEmailDomain, - 5: optional bool enableFacebookSharing, - 6: optional bool enableGiftSubscriptions, - 7: optional bool enableSupportTickets, - 8: optional bool enableSharedNotebooks, - 9: optional bool enableSingleNoteSharing, - 10: optional bool enableSponsoredAccounts, - 11: optional bool enableTwitterSharing, - 12: optional bool enableLinkedInSharing, - 13: optional bool enablePublicNotebooks, - 16: optional bool enableGoogle + 1: required string serviceHost, + 2: required string marketingUrl, + 3: required string supportUrl, + 4: required string accountEmailDomain, + 5: optional bool enableFacebookSharing, + 6: optional bool enableGiftSubscriptions, + 7: optional bool enableSupportTickets, + 8: optional bool enableSharedNotebooks, + 9: optional bool enableSingleNoteSharing, + 10: optional bool enableSponsoredAccounts, + 11: optional bool enableTwitterSharing, + 12: optional bool enableLinkedInSharing, + 13: optional bool enablePublicNotebooks, + 16: optional bool enableGoogle } /** @@ -326,8 +324,8 @@ struct BootstrapSettings { * */ struct BootstrapProfile { - 1: required string name, - 2: required BootstrapSettings settings, + 1: required string name, + 2: required BootstrapSettings settings, } /** @@ -341,7 +339,7 @@ struct BootstrapProfile { * */ struct BootstrapInfo { - 1: required list profiles + 1: required list profiles } /** @@ -364,467 +362,422 @@ struct BootstrapInfo { * */ service UserStore { + /** + * This should be the first call made by a client to the EDAM service. It + * tells the service what protocol version is used by the client. The + * service will then return true if the client is capable of talking to + * the service, and false if the client's protocol version is incompatible + * with the service, so the client must upgrade. If a client receives a + * false value, it should report the incompatibility to the user and not + * continue with any more EDAM requests (UserStore or NoteStore). + * + * @param clientName + * This string provides some information about the client for + * tracking/logging on the service. It should provide information about + * the client's software and platform. The structure should be: + * application/version; platform/version; [ device/version ] + * E.g. "Evernote Windows/3.0.1; Windows/XP SP3". + * + * @param edamVersionMajor + * This should be the major protocol version that was compiled by the + * client. This should be the current value of the EDAM_VERSION_MAJOR + * constant for the client. + * + * @param edamVersionMinor + * This should be the major protocol version that was compiled by the + * client. This should be the current value of the EDAM_VERSION_MINOR + * constant for the client. + */ + bool checkVersion(1: string clientName, 2: i16 edamVersionMajor = EDAM_VERSION_MAJOR, 3: i16 edamVersionMinor = EDAM_VERSION_MINOR), - /** - * This should be the first call made by a client to the EDAM service. It - * tells the service what protocol version is used by the client. The - * service will then return true if the client is capable of talking to - * the service, and false if the client's protocol version is incompatible - * with the service, so the client must upgrade. If a client receives a - * false value, it should report the incompatibility to the user and not - * continue with any more EDAM requests (UserStore or NoteStore). - * - * @param clientName - * This string provides some information about the client for - * tracking/logging on the service. It should provide information about - * the client's software and platform. The structure should be: - * application/version; platform/version; [ device/version ] - * E.g. "Evernote Windows/3.0.1; Windows/XP SP3". - * - * @param edamVersionMajor - * This should be the major protocol version that was compiled by the - * client. This should be the current value of the EDAM_VERSION_MAJOR - * constant for the client. - * - * @param edamVersionMinor - * This should be the major protocol version that was compiled by the - * client. This should be the current value of the EDAM_VERSION_MINOR - * constant for the client. - */ - bool checkVersion(1: string clientName, - 2: i16 edamVersionMajor = EDAM_VERSION_MAJOR, - 3: i16 edamVersionMinor = EDAM_VERSION_MINOR), - - /** - * This provides bootstrap information to the client. Various bootstrap - * profiles and settings may be used by the client to configure itself. - * - * @param locale - * The client's current locale, expressed in language[_country] - * format. E.g., "en_US". See ISO-639 and ISO-3166 for valid - * language and country codes. - * - * @return - * The bootstrap information suitable for this client. - */ - BootstrapInfo getBootstrapInfo(1: string locale), + /** + * This provides bootstrap information to the client. Various bootstrap + * profiles and settings may be used by the client to configure itself. + * + * @param locale + * The client's current locale, expressed in language[_country] + * format. E.g., "en_US". See ISO-639 and ISO-3166 for valid + * language and country codes. + * + * @return + * The bootstrap information suitable for this client. + */ + BootstrapInfo getBootstrapInfo(1: string locale), - /** - * This is used to check a username and password in order to create a - * long-lived authentication token that can be used for further actions. - * - * This function is not available to most third party applications, - * which typically authenticate using OAuth as - * described at - * dev.evernote.com. - * If you believe that your application requires permission to authenticate - * using username and password instead of OAuth, please contact Evernote - * developer support by visiting - * dev.evernote.com. - * - * @param username - * The username or registered email address of the account to - * authenticate against. - * - * @param password - * The plaintext password to check against the account. Since - * this is not protected by the EDAM protocol, this information must be - * provided over a protected transport (i.e. SSL). - * - * @param consumerKey - * The "consumer key" portion of the API key issued to the client application - * by Evernote. - * - * @param consumerSecret - * The "consumer secret" portion of the API key issued to the client application - * by Evernote. - * - * @param deviceIdentifier - * An optional string that uniquely identifies the device from which the - * authentication is being performed. This string allows the service to return the - * same authentication token when a given application requests authentication - * repeatedly from the same device. This may happen when the user logs out of an - * application and then logs back in, or when the application is uninstalled - * and later reinstalled. If no reliable device identifier can be created, - * this value should be omitted. If set, the device identifier must be between - * 1 and EDAM_DEVICE_ID_LEN_MAX characters long and must match the regular expression - * EDAM_DEVICE_ID_REGEX. - * - * @param deviceDescription - * A description of the device from which the authentication is being performed. - * This field is displayed to the user in a list of authorized applications to - * allow them to distinguish between multiple tokens issued to the same client - * application on different devices. For example, the Evernote iOS client on - * a user's iPhone and iPad might pass the iOS device names "Bob's iPhone" and - * "Bob's iPad". The device description must be between 1 and - * EDAM_DEVICE_DESCRIPTION_LEN_MAX characters long and must match the regular - * expression EDAM_DEVICE_DESCRIPTION_REGEX. - * - * @param supportsTwoFactor - * Whether the calling application supports two-factor authentication. If this - * parameter is false, this method will fail with the error code INVALID_AUTH and the - * parameter "password" when called for a user who has enabled two-factor - * authentication. - * - * @return - *

The result of the authentication. The level of detail provided in the returned - * AuthenticationResult.User structure depends on the access level granted by - * calling application's API key.

- *

If the user has two-factor authentication enabled, - * AuthenticationResult.secondFactorRequired will be set and - * AuthenticationResult.authenticationToken will contain a short-lived token - * that may only be used to complete the two-factor authentication process by calling - * UserStore.completeTwoFactorAuthentication.

- * - * @throws EDAMUserException
    - *
  • DATA_REQUIRED "username" - username is empty - *
  • DATA_REQUIRED "password" - password is empty - *
  • DATA_REQUIRED "consumerKey" - consumerKey is empty - *
  • DATA_REQUIRED "consumerSecret" - consumerSecret is empty - *
  • DATA_REQUIRED "deviceDescription" - deviceDescription is empty - *
  • BAD_DATA_FORMAT "deviceDescription" - deviceDescription is not valid. - *
  • BAD_DATA_FORMAT "deviceIdentifier" - deviceIdentifier is not valid. - *
  • INVALID_AUTH "username" - username not found - *
  • INVALID_AUTH "password" - password did not match - *
  • INVALID_AUTH "consumerKey" - consumerKey is not authorized - *
  • INVALID_AUTH "consumerSecret" - consumerSecret is incorrect - *
  • INVALID_AUTH "businessOnly" - the user is a business-only account - *
  • PERMISSION_DENIED "User.active" - user account is closed - *
  • PERMISSION_DENIED "User.tooManyFailuresTryAgainLater" - user has - * failed authentication too often - *
  • AUTH_EXPIRED "password" - user password is expired - *
- */ - AuthenticationResult authenticateLongSession(1: string username, - 2: string password, - 3: string consumerKey, - 4: string consumerSecret, - 5: string deviceIdentifier, - 6: string deviceDescription, - 7: bool supportsTwoFactor) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + /** + * This is used to check a username and password in order to create a + * long-lived authentication token that can be used for further actions. + * + * This function is not available to most third party applications, + * which typically authenticate using OAuth as + * described at + * dev.evernote.com. + * If you believe that your application requires permission to authenticate + * using username and password instead of OAuth, please contact Evernote + * developer support by visiting + * dev.evernote.com. + * + * @param username + * The username or registered email address of the account to + * authenticate against. + * + * @param password + * The plaintext password to check against the account. Since + * this is not protected by the EDAM protocol, this information must be + * provided over a protected transport (i.e. SSL). + * + * @param consumerKey + * The "consumer key" portion of the API key issued to the client application + * by Evernote. + * + * @param consumerSecret + * The "consumer secret" portion of the API key issued to the client application + * by Evernote. + * + * @param deviceIdentifier + * An optional string that uniquely identifies the device from which the + * authentication is being performed. This string allows the service to return the + * same authentication token when a given application requests authentication + * repeatedly from the same device. This may happen when the user logs out of an + * application and then logs back in, or when the application is uninstalled + * and later reinstalled. If no reliable device identifier can be created, + * this value should be omitted. If set, the device identifier must be between + * 1 and EDAM_DEVICE_ID_LEN_MAX characters long and must match the regular expression + * EDAM_DEVICE_ID_REGEX. + * + * @param deviceDescription + * A description of the device from which the authentication is being performed. + * This field is displayed to the user in a list of authorized applications to + * allow them to distinguish between multiple tokens issued to the same client + * application on different devices. For example, the Evernote iOS client on + * a user's iPhone and iPad might pass the iOS device names "Bob's iPhone" and + * "Bob's iPad". The device description must be between 1 and + * EDAM_DEVICE_DESCRIPTION_LEN_MAX characters long and must match the regular + * expression EDAM_DEVICE_DESCRIPTION_REGEX. + * + * @param supportsTwoFactor + * Whether the calling application supports two-factor authentication. If this + * parameter is false, this method will fail with the error code INVALID_AUTH and the + * parameter "password" when called for a user who has enabled two-factor + * authentication. + * + * @return + *

The result of the authentication. The level of detail provided in the returned + * AuthenticationResult.User structure depends on the access level granted by + * calling application's API key.

+ *

If the user has two-factor authentication enabled, + * AuthenticationResult.secondFactorRequired will be set and + * AuthenticationResult.authenticationToken will contain a short-lived token + * that may only be used to complete the two-factor authentication process by calling + * UserStore.completeTwoFactorAuthentication.

+ * + * @throws EDAMUserException
    + *
  • DATA_REQUIRED "username" - username is empty + *
  • DATA_REQUIRED "password" - password is empty + *
  • DATA_REQUIRED "consumerKey" - consumerKey is empty + *
  • DATA_REQUIRED "consumerSecret" - consumerSecret is empty + *
  • DATA_REQUIRED "deviceDescription" - deviceDescription is empty + *
  • BAD_DATA_FORMAT "deviceDescription" - deviceDescription is not valid. + *
  • BAD_DATA_FORMAT "deviceIdentifier" - deviceIdentifier is not valid. + *
  • INVALID_AUTH "username" - username not found + *
  • INVALID_AUTH "password" - password did not match + *
  • INVALID_AUTH "consumerKey" - consumerKey is not authorized + *
  • INVALID_AUTH "consumerSecret" - consumerSecret is incorrect + *
  • INVALID_AUTH "businessOnly" - the user is a business-only account + *
  • PERMISSION_DENIED "User.active" - user account is closed + *
  • PERMISSION_DENIED "User.tooManyFailuresTryAgainLater" - user has + * failed authentication too often + *
  • AUTH_EXPIRED "password" - user password is expired + *
+ */ + AuthenticationResult authenticateLongSession(1: string username, 2: string password, 3: string consumerKey, 4: string consumerSecret, 5: string deviceIdentifier, 6: string deviceDescription, 7: bool supportsTwoFactor) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * Complete the authentication process when a second factor is required. This - * call is made after a successful call to authenticate or authenticateLongSession - * when the authenticating user has enabled two-factor authentication. - * - * @param authenticationToken An authentication token returned by a previous - * call to UserStore.authenticate or UserStore.authenticateLongSession that - * could not be completed in a single call because a second factor was required. - * - * @param oneTimeCode The one time code entered by the user. This value is delivered - * out-of-band, typically via SMS or an authenticator application. - * - * @param deviceIdentifier See the corresponding parameter in authenticateLongSession. - * - * @param deviceDescription See the corresponding parameter in authenticateLongSession. - * - * @return - * The result of the authentication. The level of detail provided in the returned - * AuthenticationResult.User structure depends on the access level granted by the - * calling application's API key. If the initial authentication call was made to - * authenticateLongSession, the AuthenticationResult will contain a long-lived - * authentication token. - * - * @throws EDAMUserException
    - *
  • DATA_REQUIRED "authenticationToken" - authenticationToken is empty - *
  • DATA_REQUIRED "oneTimeCode" - oneTimeCode is empty - *
  • BAD_DATA_FORMAT "deviceIdentifier" - deviceIdentifier is not valid - *
  • BAD_DATA_FORMAT "authenticationToken" - authenticationToken is not well formed - *
  • INVALID_AUTH "oneTimeCode" - oneTimeCode did not match - *
  • AUTH_EXPIRED "authenticationToken" - authenticationToken has expired - *
  • PERMISSION_DENIED "authenticationToken" - authenticationToken is not valid - *
  • PERMISSION_DENIED "User.active" - user account is closed - *
  • PERMISSION_DENIED "User.tooManyFailuresTryAgainLater" - user has - * failed authentication too often - *
  • DATA_CONFLICT "User.twoFactorAuthentication" - The user has not enabled - * two-factor authentication.
  • - *
- */ - AuthenticationResult completeTwoFactorAuthentication(1: string authenticationToken, - 2: string oneTimeCode, - 3: string deviceIdentifier, - 4: string deviceDescription) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + /** + * Complete the authentication process when a second factor is required. This + * call is made after a successful call to authenticate or authenticateLongSession + * when the authenticating user has enabled two-factor authentication. + * + * @param authenticationToken An authentication token returned by a previous + * call to UserStore.authenticate or UserStore.authenticateLongSession that + * could not be completed in a single call because a second factor was required. + * + * @param oneTimeCode The one time code entered by the user. This value is delivered + * out-of-band, typically via SMS or an authenticator application. + * + * @param deviceIdentifier See the corresponding parameter in authenticateLongSession. + * + * @param deviceDescription See the corresponding parameter in authenticateLongSession. + * + * @return + * The result of the authentication. The level of detail provided in the returned + * AuthenticationResult.User structure depends on the access level granted by the + * calling application's API key. If the initial authentication call was made to + * authenticateLongSession, the AuthenticationResult will contain a long-lived + * authentication token. + * + * @throws EDAMUserException
    + *
  • DATA_REQUIRED "authenticationToken" - authenticationToken is empty + *
  • DATA_REQUIRED "oneTimeCode" - oneTimeCode is empty + *
  • BAD_DATA_FORMAT "deviceIdentifier" - deviceIdentifier is not valid + *
  • BAD_DATA_FORMAT "authenticationToken" - authenticationToken is not well formed + *
  • INVALID_AUTH "oneTimeCode" - oneTimeCode did not match + *
  • AUTH_EXPIRED "authenticationToken" - authenticationToken has expired + *
  • PERMISSION_DENIED "authenticationToken" - authenticationToken is not valid + *
  • PERMISSION_DENIED "User.active" - user account is closed + *
  • PERMISSION_DENIED "User.tooManyFailuresTryAgainLater" - user has + * failed authentication too often + *
  • DATA_CONFLICT "User.twoFactorAuthentication" - The user has not enabled + * two-factor authentication.
  • + *
+ */ + AuthenticationResult completeTwoFactorAuthentication(1: string authenticationToken, 2: string oneTimeCode, 3: string deviceIdentifier, 4: string deviceDescription) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * Revoke an existing long lived authentication token. This can be used to - * revoke OAuth tokens or tokens created by calling authenticateLongSession, - * and allows a user to effectively log out of Evernote from the perspective - * of the application that holds the token. The authentication token that is - * passed is immediately revoked and may not be used to call any authenticated - * EDAM function. - * - * @param authenticationToken the authentication token to revoke. - * - * @throws EDAMUserException
    - *
  • DATA_REQUIRED "authenticationToken" - no authentication token provided - *
  • BAD_DATA_FORMAT "authenticationToken" - the authentication token is not well formed - *
  • INVALID_AUTH "authenticationToken" - the authentication token is invalid - *
  • AUTH_EXPIRED "authenticationToken" - the authentication token is expired or - * is already revoked. - *
- */ - void revokeLongSession(1: string authenticationToken) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + /** + * Revoke an existing long lived authentication token. This can be used to + * revoke OAuth tokens or tokens created by calling authenticateLongSession, + * and allows a user to effectively log out of Evernote from the perspective + * of the application that holds the token. The authentication token that is + * passed is immediately revoked and may not be used to call any authenticated + * EDAM function. + * + * @param authenticationToken the authentication token to revoke. + * + * @throws EDAMUserException
    + *
  • DATA_REQUIRED "authenticationToken" - no authentication token provided + *
  • BAD_DATA_FORMAT "authenticationToken" - the authentication token is not well formed + *
  • INVALID_AUTH "authenticationToken" - the authentication token is invalid + *
  • AUTH_EXPIRED "authenticationToken" - the authentication token is expired or + * is already revoked. + *
+ */ + void revokeLongSession(1: string authenticationToken) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * This is used to take an existing authentication token that grants access - * to an individual user account (returned from 'authenticate', - * 'authenticateLongSession' or an OAuth authorization) and obtain an additional - * authentication token that may be used to access business notebooks if the user - * is a member of an Evernote Business account. - * - * The resulting authentication token may be used to make NoteStore API calls - * against the business using the NoteStore URL returned in the result. - * - * @param authenticationToken - * The authentication token for the user. This may not be a shared authentication - * token (returned by NoteStore.authenticateToSharedNotebook or - * NoteStore.authenticateToSharedNote) or a business authentication token. - * - * @return - * The result of the authentication, with the token granting access to the - * business in the result's 'authenticationToken' field. The URL that must - * be used to access the business account NoteStore will be returned in the - * result's 'noteStoreUrl' field. The 'User' field will - * not be set in the result. - * - * @throws EDAMUserException
    - *
  • PERMISSION_DENIED "authenticationToken" - the provided authentication token - * is a shared or business authentication token.
  • - *
  • PERMISSION_DENIED "Business" - the user identified by the provided - * authentication token is not currently a member of a business.
  • - *
  • PERMISSION_DENIED "Business.status" - the business that the user is a - * member of is not currently in an active status.
  • - *
  • BUSINESS_SECURITY_LOGIN_REQUIRED "sso" - the user must complete single - * sign-on before authenticating to the business. - *
- */ - AuthenticationResult authenticateToBusiness(1: string authenticationToken) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + /** + * This is used to take an existing authentication token that grants access + * to an individual user account (returned from 'authenticate', + * 'authenticateLongSession' or an OAuth authorization) and obtain an additional + * authentication token that may be used to access business notebooks if the user + * is a member of an Evernote Business account. + * + * The resulting authentication token may be used to make NoteStore API calls + * against the business using the NoteStore URL returned in the result. + * + * @param authenticationToken + * The authentication token for the user. This may not be a shared authentication + * token (returned by NoteStore.authenticateToSharedNotebook or + * NoteStore.authenticateToSharedNote) or a business authentication token. + * + * @return + * The result of the authentication, with the token granting access to the + * business in the result's 'authenticationToken' field. The URL that must + * be used to access the business account NoteStore will be returned in the + * result's 'noteStoreUrl' field. The 'User' field will + * not be set in the result. + * + * @throws EDAMUserException
    + *
  • PERMISSION_DENIED "authenticationToken" - the provided authentication token + * is a shared or business authentication token.
  • + *
  • PERMISSION_DENIED "Business" - the user identified by the provided + * authentication token is not currently a member of a business.
  • + *
  • PERMISSION_DENIED "Business.status" - the business that the user is a + * member of is not currently in an active status.
  • + *
  • BUSINESS_SECURITY_LOGIN_REQUIRED "sso" - the user must complete single + * sign-on before authenticating to the business. + *
+ */ + AuthenticationResult authenticateToBusiness(1: string authenticationToken) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * Returns the User corresponding to the provided authentication token, - * or throws an exception if this token is not valid. - * The level of detail provided in the returned User structure depends on - * the access level granted by the token, so a web service client may receive - * fewer fields than an integrated desktop client. - */ - Types.User getUser(1: string authenticationToken) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + /** + * Returns the User corresponding to the provided authentication token, + * or throws an exception if this token is not valid. + * The level of detail provided in the returned User structure depends on + * the access level granted by the token, so a web service client may receive + * fewer fields than an integrated desktop client. + */ + Types.User getUser(1: string authenticationToken) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * Asks the UserStore about the publicly available location information for - * a particular username. - * - * @throws EDAMUserException
    - *
  • DATA_REQUIRED "username" - username is empty - *
- */ - PublicUserInfo getPublicUserInfo(1: string username) - throws (1: Errors.EDAMNotFoundException notFoundException, - 2: Errors.EDAMSystemException systemException, - 3: Errors.EDAMUserException userException), + /** + * Asks the UserStore about the publicly available location information for + * a particular username. + * + * @throws EDAMUserException
    + *
  • DATA_REQUIRED "username" - username is empty + *
+ */ + PublicUserInfo getPublicUserInfo(1: string username) throws (1: Errors.EDAMNotFoundException notFoundException, 2: Errors.EDAMSystemException systemException, 3: Errors.EDAMUserException userException), - /** - *

Returns the URLs that should be used when sending requests to the service on - * behalf of the account represented by the provided authenticationToken.

- * - *

This method isn't needed by most clients, who can retreive the correct set of - * UserUrls from the AuthenticationResult returned from - * UserStore#authenticateLongSession(). This method is typically only needed to look up - * the correct URLs for an existing long-lived authentication token.

- */ + /** + *

Returns the URLs that should be used when sending requests to the service on + * behalf of the account represented by the provided authenticationToken.

+ * + *

This method isn't needed by most clients, who can retreive the correct set of + * UserUrls from the AuthenticationResult returned from + * UserStore#authenticateLongSession(). This method is typically only needed to look up + * the correct URLs for an existing long-lived authentication token.

+ */ - UserUrls getUserUrls(1: string authenticationToken) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + UserUrls getUserUrls(1: string authenticationToken) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * Invite a user to join an Evernote Business account. - * - * Behavior will depend on the auth token.
    - *
  1. - * auth token with privileges to manage Evernote Business membership. - * "External Provisioning" - The user will receive an email inviting - * them to join the business. They do not need to have an existing Evernote - * account. If the user has already been invited, a new invitation email - * will be sent. - *
  2. - *
  3. - * business auth token issued to an admin user. Only for first-party clients: - * "Approve Invitation" - If there has been a request to invite the email, - * approve it. Invited user will receive email with a link to join business. - * "Invite User" - If no invitation for the email exists, create an approved - * invitation for the email. An email will be sent to the emailAddress with - * a link to join the caller's business. - *
  4. - * - * business auth token: - * "Request Invitation" - If no invitation exists, create a request to - * invite the user to the business. These requests do not count towards a - * business' max active user limit. - * - *
- * - * @param authenticationToken - * the authentication token with sufficient privileges to manage Evernote Business - * membership or a business auth token. - * - * @param emailAddress - * the email address of the user to invite to join the Evernote Business account. - * - * @throws EDAMUserException
    - *
  • DATA_REQUIRED "email" - if no email address was provided
  • - *
  • BAD_DATA_FORMAT "email" - if the email address is not well formed
  • - *
  • DATA_CONFLICT "BusinessUser.email" - if there is already a user in the business - * whose business email address matches the specified email address.
  • - *
  • LIMIT_REACHED "Business.maxActiveUsers" - if the business has reached its - * user limit.
  • - *
- */ - void inviteToBusiness(1: string authenticationToken, - 2: string emailAddress) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + /** + * Invite a user to join an Evernote Business account. + * + * Behavior will depend on the auth token.
    + *
  1. + * auth token with privileges to manage Evernote Business membership. + * "External Provisioning" - The user will receive an email inviting + * them to join the business. They do not need to have an existing Evernote + * account. If the user has already been invited, a new invitation email + * will be sent. + *
  2. + *
  3. + * business auth token issued to an admin user. Only for first-party clients: + * "Approve Invitation" - If there has been a request to invite the email, + * approve it. Invited user will receive email with a link to join business. + * "Invite User" - If no invitation for the email exists, create an approved + * invitation for the email. An email will be sent to the emailAddress with + * a link to join the caller's business. + *
  4. + * + * business auth token: + * "Request Invitation" - If no invitation exists, create a request to + * invite the user to the business. These requests do not count towards a + * business' max active user limit. + * + *
+ * + * @param authenticationToken + * the authentication token with sufficient privileges to manage Evernote Business + * membership or a business auth token. + * + * @param emailAddress + * the email address of the user to invite to join the Evernote Business account. + * + * @throws EDAMUserException
    + *
  • DATA_REQUIRED "email" - if no email address was provided
  • + *
  • BAD_DATA_FORMAT "email" - if the email address is not well formed
  • + *
  • DATA_CONFLICT "BusinessUser.email" - if there is already a user in the business + * whose business email address matches the specified email address.
  • + *
  • LIMIT_REACHED "Business.maxActiveUsers" - if the business has reached its + * user limit.
  • + *
+ */ + void inviteToBusiness(1: string authenticationToken, 2: string emailAddress) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * Remove a user from an Evernote Business account. Once removed, the user will no - * longer be able to access content within the Evernote Business account. - * - *

The email address of the user to remove from the business must match the email - * address used to invite a user to join the business via UserStore.inviteToBusiness. - * This function will only remove users who were invited by external provisioning

- * - * @param authenticationToken - * An authentication token with sufficient privileges to manage Evernote Business - * membership. - * - * @param emailAddress - * The email address of the user to remove from the Evernote Business account. - * - * @throws EDAMUserException
    - *
  • DATA_REQUIRED "email" - if no email address was provided
  • - *
  • BAD_DATA_FORMAT "email" - The email address is not well formed
  • - *
- * @throws EDAMNotFoundException
    - *
  • "email" - If there is no user with the specified email address in the - * business or that user was not invited via external provisioning.
  • - *
- */ - void removeFromBusiness(1: string authenticationToken, - 2: string emailAddress) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException, - 3: Errors.EDAMNotFoundException notFoundException), + /** + * Remove a user from an Evernote Business account. Once removed, the user will no + * longer be able to access content within the Evernote Business account. + * + *

The email address of the user to remove from the business must match the email + * address used to invite a user to join the business via UserStore.inviteToBusiness. + * This function will only remove users who were invited by external provisioning

+ * + * @param authenticationToken + * An authentication token with sufficient privileges to manage Evernote Business + * membership. + * + * @param emailAddress + * The email address of the user to remove from the Evernote Business account. + * + * @throws EDAMUserException
    + *
  • DATA_REQUIRED "email" - if no email address was provided
  • + *
  • BAD_DATA_FORMAT "email" - The email address is not well formed
  • + *
+ * @throws EDAMNotFoundException
    + *
  • "email" - If there is no user with the specified email address in the + * business or that user was not invited via external provisioning.
  • + *
+ */ + void removeFromBusiness(1: string authenticationToken, 2: string emailAddress) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException, 3: Errors.EDAMNotFoundException notFoundException), - /** - * Update the email address used to uniquely identify an Evernote Business user. - * - * This will update the identifier for a user who was previously invited using - * inviteToBusiness, ensuring that caller and the Evernote service maintain an - * agreed-upon identifier for a specific user. - * - * For example, the following sequence of calls would invite a user to join - * a business, update their email address, and then remove the user - * from the business using the updated email address. - * - * inviteToBusiness("foo@bar.com") - * updateBusinessUserIdentifier("foo@bar.com", "baz@bar.com") - * removeFromBusiness("baz@bar.com") - * - * @param authenticationToken - * An authentication token with sufficient privileges to manage Evernote Business - * membership. - * - * @param oldEmailAddress - * The existing email address used to uniquely identify the user. - * - * @param newEmailAddress - * The new email address used to uniquely identify the user. - * - * @throws EDAMUserException
    - *
  • DATA_REQUIRED "oldEmailAddress" - No old email address was provided
  • - *
  • DATA_REQUIRED "newEmailAddress" - No new email address was provided
  • - *
  • BAD_DATA_FORMAT "oldEmailAddress" - The old email address is not well formed
  • - *
  • BAD_DATA_FORMAT "newEmailAddress" - The new email address is not well formed
  • - *
  • DATA_CONFLICT "oldEmailAddress" - The old and new email addresses were the same
  • - *
  • DATA_CONFLICT "newEmailAddress" - There is already an invitation or registered user with - * the provided new email address.
  • - *
  • DATA_CONFLICT "invitation.externallyProvisioned" - The user identified by - * oldEmailAddress was not added via UserStore.inviteToBusiness and therefore cannot be - * updated.
  • - *
- * @throws EDAMNotFoundException
    - *
  • "oldEmailAddress" - If there is no user or invitation with the specified oldEmailAddress - * in the business.
  • - *
- */ - void updateBusinessUserIdentifier(1: string authenticationToken, - 2: string oldEmailAddress, - 3: string newEmailAddress) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException, - 3: Errors.EDAMNotFoundException notFoundException), + /** + * Update the email address used to uniquely identify an Evernote Business user. + * + * This will update the identifier for a user who was previously invited using + * inviteToBusiness, ensuring that caller and the Evernote service maintain an + * agreed-upon identifier for a specific user. + * + * For example, the following sequence of calls would invite a user to join + * a business, update their email address, and then remove the user + * from the business using the updated email address. + * + * inviteToBusiness("foo@bar.com") + * updateBusinessUserIdentifier("foo@bar.com", "baz@bar.com") + * removeFromBusiness("baz@bar.com") + * + * @param authenticationToken + * An authentication token with sufficient privileges to manage Evernote Business + * membership. + * + * @param oldEmailAddress + * The existing email address used to uniquely identify the user. + * + * @param newEmailAddress + * The new email address used to uniquely identify the user. + * + * @throws EDAMUserException
    + *
  • DATA_REQUIRED "oldEmailAddress" - No old email address was provided
  • + *
  • DATA_REQUIRED "newEmailAddress" - No new email address was provided
  • + *
  • BAD_DATA_FORMAT "oldEmailAddress" - The old email address is not well formed
  • + *
  • BAD_DATA_FORMAT "newEmailAddress" - The new email address is not well formed
  • + *
  • DATA_CONFLICT "oldEmailAddress" - The old and new email addresses were the same
  • + *
  • DATA_CONFLICT "newEmailAddress" - There is already an invitation or registered user with + * the provided new email address.
  • + *
  • DATA_CONFLICT "invitation.externallyProvisioned" - The user identified by + * oldEmailAddress was not added via UserStore.inviteToBusiness and therefore cannot be + * updated.
  • + *
+ * @throws EDAMNotFoundException
    + *
  • "oldEmailAddress" - If there is no user or invitation with the specified oldEmailAddress + * in the business.
  • + *
+ */ + void updateBusinessUserIdentifier(1: string authenticationToken, 2: string oldEmailAddress, 3: string newEmailAddress) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException, 3: Errors.EDAMNotFoundException notFoundException), - /** - * Returns a list of active business users in a given business. - * - * Clients are required to cache this information and re-fetch no more than once per day - * or when they encountered a user ID or username that was not known to them. - * - * To avoid excessive look ups, clients should also track user IDs and usernames that belong - * to users who are not in the business, since they will not be included in the result. - * - * I.e., when a client encounters a previously unknown user ID as a note's creator, it may query - * listBusinessUsers to find information about this user. If the user is not in the resulting - * list, the client should track that fact and not re-query the service the next time that it sees - * this user on a note. - * - * @param authenticationToken - * A business authentication token returned by authenticateToBusiness or with sufficient - * privileges to manage Evernote Business membership. - */ - list listBusinessUsers(1: string authenticationToken) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + /** + * Returns a list of active business users in a given business. + * + * Clients are required to cache this information and re-fetch no more than once per day + * or when they encountered a user ID or username that was not known to them. + * + * To avoid excessive look ups, clients should also track user IDs and usernames that belong + * to users who are not in the business, since they will not be included in the result. + * + * I.e., when a client encounters a previously unknown user ID as a note's creator, it may query + * listBusinessUsers to find information about this user. If the user is not in the resulting + * list, the client should track that fact and not re-query the service the next time that it sees + * this user on a note. + * + * @param authenticationToken + * A business authentication token returned by authenticateToBusiness or with sufficient + * privileges to manage Evernote Business membership. + */ + list listBusinessUsers(1: string authenticationToken) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * Returns a list of outstanding invitations to join an Evernote Business account. - * - * Only outstanding invitations are returned by this function. Users who have accepted an - * invitation and joined a business are listed using listBusinessUsers. - * - * @param authenticationToken - * An authentication token with sufficient privileges to manage Evernote Business membership. - * - * @param includeRequestedInvitations - * If true, invitations with a status of BusinessInvitationStatus.REQUESTED will be included - * in the returned list. If false, only invitations with a status of - * BusinessInvitationStatus.APPROVED will be included. - */ - list listBusinessInvitations(1: string authenticationToken, - 2: bool includeRequestedInvitations) - throws (1: Errors.EDAMUserException userException, - 2: Errors.EDAMSystemException systemException), + /** + * Returns a list of outstanding invitations to join an Evernote Business account. + * + * Only outstanding invitations are returned by this function. Users who have accepted an + * invitation and joined a business are listed using listBusinessUsers. + * + * @param authenticationToken + * An authentication token with sufficient privileges to manage Evernote Business membership. + * + * @param includeRequestedInvitations + * If true, invitations with a status of BusinessInvitationStatus.REQUESTED will be included + * in the returned list. If false, only invitations with a status of + * BusinessInvitationStatus.APPROVED will be included. + */ + list listBusinessInvitations(1: string authenticationToken, 2: bool includeRequestedInvitations) throws (1: Errors.EDAMUserException userException, 2: Errors.EDAMSystemException systemException), - /** - * Retrieve the standard account limits for a given service level. This should only be - * called when necessary, e.g. to determine if a higher level is available should the - * user upgrade, and should be cached for long periods (e.g. 30 days) as the values are - * not expected to fluctuate frequently. - * - * @throws EDAMUserException
    - *
  • DATA_REQUIRED "serviceLevel" - serviceLevel is null
  • - *
- */ - Types.AccountLimits getAccountLimits(1: Types.ServiceLevel serviceLevel) - throws (1: Errors.EDAMUserException userException), + /** + * Retrieve the standard account limits for a given service level. This should only be + * called when necessary, e.g. to determine if a higher level is available should the + * user upgrade, and should be cached for long periods (e.g. 30 days) as the values are + * not expected to fluctuate frequently. + * + * @throws EDAMUserException
    + *
  • DATA_REQUIRED "serviceLevel" - serviceLevel is null
  • + *
+ */ + Types.AccountLimits getAccountLimits(1: Types.ServiceLevel serviceLevel) throws (1: Errors.EDAMUserException userException), } diff --git a/tests/evernote-thrift/src/test.thrift b/tests/evernote-thrift/src/test.thrift index 3e23c9c..3f891c1 100644 --- a/tests/evernote-thrift/src/test.thrift +++ b/tests/evernote-thrift/src/test.thrift @@ -1,4 +1,19 @@ struct A {} + struct B { 1: A str, } + +struct C {} + +service D {} + +exception E {} + +service F {} + +service H { + bool func1() + + bool func2() +} \ No newline at end of file -- 2.51.2