clickatell_api/one_api/send_messages/
gateway_error_code.rs

1use serde_repr::Deserialize_repr;
2
3/// Error codes returnd in a
4/// [GatewayError][crate::one_api::send_messages::GatewayErrorCode]
5#[derive(Deserialize_repr, PartialEq, Debug, Copy, Clone)]
6#[repr(u8)]
7pub enum GatewayErrorCode {
8  InvalidOrMissingIntegrationAPIKey = 1,
9  AccountIsNotActive = 2,
10  IntegrationIsNotActive = 3,
11  OriginatingIPAddressIsNotApprovedInYourAccount = 7,
12  InternalError = 18,
13  InternalErrorPleaseRetry = 19,
14  InsufficientAccountBalance = 20,
15  PayloadDataIsMalformed = 21,
16  MaximumMessagesPerRequestPayloadExceeded = 22,
17  InvalidOrMissingParameter = 23,
18  MaximumMessageContentSizeExceeded = 24,
19  InvalidRecipientAddress = 25,
20  RecipientOptedOut = 26,
21  RecipientNotAvailableOnChannel = 27,
22  RecipientNotAvailableOnSandbox = 28,
23  ContentTypeNotSupported = 30,
24  MediaFileSizeExceedsLimit = 31,
25  MediaPayloadSizeExceedsLimit = 32,
26  MediaItemNotFound = 33,
27  ChannelFeatureIsNotActiveOnIntegration = 38,
28  ChannelIsNotAvailableOnIntegration = 39,
29  CharacterSetIsNotsupported = 40,
30  ResourceDoesNotExist = 41,
31  HttpMethodIsNotSupportedOnThisResource = 42,
32  RateLimit = 43,
33  FromNumberIsSuspended = 44,
34  FromNumberIsNotRelatedToIntegration = 45,
35  DemoAccessHasExpired = 46,
36  MaximumMessagePartsExceeded = 100,
37  DestinationDoesNotSupportTwoWayMessaging = 101,
38  UsaCountryLimitMustUseTwoWayIntegration = 110,
39  UsaCountryLimitMustEnableStopSUbscribeCommandsOnIntegration = 111,
40}
41
42impl std::fmt::Display for GatewayErrorCode {
43  fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
44    write!(f, "{}", *self as u8)
45  }
46}
47
48#[test]
49fn test_display() {
50  assert_eq!(
51    "1",
52    format!("{}", GatewayErrorCode::InvalidOrMissingIntegrationAPIKey)
53  );
54}