amocrm 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +19 -0
  4. data/README.md +233 -0
  5. data/SECURITY.md +23 -0
  6. data/lib/amocrm/client.rb +65 -0
  7. data/lib/amocrm/errors.rb +228 -0
  8. data/lib/amocrm/file_part.rb +58 -0
  9. data/lib/amocrm/internal/transport/base_client.rb +567 -0
  10. data/lib/amocrm/internal/transport/pooled_net_requester.rb +210 -0
  11. data/lib/amocrm/internal/type/array_of.rb +168 -0
  12. data/lib/amocrm/internal/type/base_model.rb +523 -0
  13. data/lib/amocrm/internal/type/base_page.rb +55 -0
  14. data/lib/amocrm/internal/type/boolean.rb +77 -0
  15. data/lib/amocrm/internal/type/converter.rb +327 -0
  16. data/lib/amocrm/internal/type/enum.rb +131 -0
  17. data/lib/amocrm/internal/type/file_input.rb +111 -0
  18. data/lib/amocrm/internal/type/hash_of.rb +188 -0
  19. data/lib/amocrm/internal/type/request_parameters.rb +42 -0
  20. data/lib/amocrm/internal/type/union.rb +248 -0
  21. data/lib/amocrm/internal/type/unknown.rb +81 -0
  22. data/lib/amocrm/internal/util.rb +920 -0
  23. data/lib/amocrm/internal.rb +20 -0
  24. data/lib/amocrm/models/v4/leads/unsorted_accept_params.rb +34 -0
  25. data/lib/amocrm/models/v4/leads/unsorted_accept_response.rb +172 -0
  26. data/lib/amocrm/models/v4/leads/unsorted_create_forms_params.rb +883 -0
  27. data/lib/amocrm/models/v4/leads/unsorted_create_forms_response.rb +204 -0
  28. data/lib/amocrm/models/v4/leads/unsorted_decline_params.rb +26 -0
  29. data/lib/amocrm/models/v4/leads/unsorted_decline_response.rb +172 -0
  30. data/lib/amocrm/models.rb +43 -0
  31. data/lib/amocrm/request_options.rb +77 -0
  32. data/lib/amocrm/resources/v4/leads/unsorted.rb +83 -0
  33. data/lib/amocrm/resources/v4/leads.rb +20 -0
  34. data/lib/amocrm/resources/v4.rb +18 -0
  35. data/lib/amocrm/version.rb +5 -0
  36. data/lib/amocrm.rb +64 -0
  37. data/manifest.yaml +17 -0
  38. data/rbi/amocrm/client.rbi +44 -0
  39. data/rbi/amocrm/errors.rbi +205 -0
  40. data/rbi/amocrm/file_part.rbi +37 -0
  41. data/rbi/amocrm/internal/transport/base_client.rbi +292 -0
  42. data/rbi/amocrm/internal/transport/pooled_net_requester.rbi +82 -0
  43. data/rbi/amocrm/internal/type/array_of.rbi +104 -0
  44. data/rbi/amocrm/internal/type/base_model.rbi +299 -0
  45. data/rbi/amocrm/internal/type/base_page.rbi +42 -0
  46. data/rbi/amocrm/internal/type/boolean.rbi +58 -0
  47. data/rbi/amocrm/internal/type/converter.rbi +204 -0
  48. data/rbi/amocrm/internal/type/enum.rbi +82 -0
  49. data/rbi/amocrm/internal/type/file_input.rbi +59 -0
  50. data/rbi/amocrm/internal/type/hash_of.rbi +104 -0
  51. data/rbi/amocrm/internal/type/request_parameters.rbi +29 -0
  52. data/rbi/amocrm/internal/type/union.rbi +126 -0
  53. data/rbi/amocrm/internal/type/unknown.rbi +58 -0
  54. data/rbi/amocrm/internal/util.rbi +484 -0
  55. data/rbi/amocrm/internal.rbi +16 -0
  56. data/rbi/amocrm/models/v4/leads/unsorted_accept_params.rbi +64 -0
  57. data/rbi/amocrm/models/v4/leads/unsorted_accept_response.rbi +441 -0
  58. data/rbi/amocrm/models/v4/leads/unsorted_create_forms_params.rbi +1927 -0
  59. data/rbi/amocrm/models/v4/leads/unsorted_create_forms_response.rbi +502 -0
  60. data/rbi/amocrm/models/v4/leads/unsorted_decline_params.rbi +50 -0
  61. data/rbi/amocrm/models/v4/leads/unsorted_decline_response.rbi +441 -0
  62. data/rbi/amocrm/models.rbi +5 -0
  63. data/rbi/amocrm/request_options.rbi +55 -0
  64. data/rbi/amocrm/resources/v4/leads/unsorted.rbi +67 -0
  65. data/rbi/amocrm/resources/v4/leads.rbi +17 -0
  66. data/rbi/amocrm/resources/v4.rbi +15 -0
  67. data/rbi/amocrm/version.rbi +5 -0
  68. data/sig/amocrm/client.rbs +24 -0
  69. data/sig/amocrm/errors.rbs +117 -0
  70. data/sig/amocrm/file_part.rbs +21 -0
  71. data/sig/amocrm/internal/transport/base_client.rbs +131 -0
  72. data/sig/amocrm/internal/transport/pooled_net_requester.rbs +48 -0
  73. data/sig/amocrm/internal/type/array_of.rbs +48 -0
  74. data/sig/amocrm/internal/type/base_model.rbs +102 -0
  75. data/sig/amocrm/internal/type/base_page.rbs +24 -0
  76. data/sig/amocrm/internal/type/boolean.rbs +26 -0
  77. data/sig/amocrm/internal/type/converter.rbs +79 -0
  78. data/sig/amocrm/internal/type/enum.rbs +32 -0
  79. data/sig/amocrm/internal/type/file_input.rbs +25 -0
  80. data/sig/amocrm/internal/type/hash_of.rbs +48 -0
  81. data/sig/amocrm/internal/type/request_parameters.rbs +17 -0
  82. data/sig/amocrm/internal/type/union.rbs +52 -0
  83. data/sig/amocrm/internal/type/unknown.rbs +26 -0
  84. data/sig/amocrm/internal/util.rbs +185 -0
  85. data/sig/amocrm/internal.rbs +9 -0
  86. data/sig/amocrm/models/v4/leads/unsorted_accept_params.rbs +36 -0
  87. data/sig/amocrm/models/v4/leads/unsorted_accept_response.rbs +203 -0
  88. data/sig/amocrm/models/v4/leads/unsorted_create_forms_params.rbs +920 -0
  89. data/sig/amocrm/models/v4/leads/unsorted_create_forms_response.rbs +237 -0
  90. data/sig/amocrm/models/v4/leads/unsorted_decline_params.rbs +29 -0
  91. data/sig/amocrm/models/v4/leads/unsorted_decline_response.rbs +203 -0
  92. data/sig/amocrm/models.rbs +3 -0
  93. data/sig/amocrm/request_options.rbs +34 -0
  94. data/sig/amocrm/resources/v4/leads/unsorted.rbs +29 -0
  95. data/sig/amocrm/resources/v4/leads.rbs +11 -0
  96. data/sig/amocrm/resources/v4.rbs +9 -0
  97. data/sig/amocrm/version.rbs +3 -0
  98. metadata +169 -0
@@ -0,0 +1,204 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ module Models
5
+ module V4
6
+ module Leads
7
+ # @see Amocrm::Resources::V4::Leads::Unsorted#create_forms
8
+ module UnsortedCreateFormsResponse
9
+ extend Amocrm::Internal::Type::Union
10
+
11
+ variant -> { Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse }
12
+
13
+ variant -> { Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::Problem }
14
+
15
+ class UnsortedCreateResponse < Amocrm::Internal::Type::BaseModel
16
+ # @!attribute _embedded
17
+ #
18
+ # @return [Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded, nil]
19
+ optional :_embedded,
20
+ -> { Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded }
21
+
22
+ # @!attribute _total_items
23
+ #
24
+ # @return [Integer, nil]
25
+ optional :_total_items, Integer
26
+
27
+ # @!method initialize(_embedded: nil, _total_items: nil)
28
+ # @param _embedded [Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded]
29
+ # @param _total_items [Integer]
30
+
31
+ # @see Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse#_embedded
32
+ class Embedded < Amocrm::Internal::Type::BaseModel
33
+ # @!attribute unsorted
34
+ #
35
+ # @return [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted>, nil]
36
+ optional :unsorted,
37
+ -> { Amocrm::Internal::Type::ArrayOf[Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted] }
38
+
39
+ # @!method initialize(unsorted: nil)
40
+ # @param unsorted [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted>]
41
+
42
+ class Unsorted < Amocrm::Internal::Type::BaseModel
43
+ # @!attribute _embedded
44
+ #
45
+ # @return [Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded, nil]
46
+ optional :_embedded,
47
+ -> { Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded }
48
+
49
+ # @!attribute _links
50
+ #
51
+ # @return [Object, nil]
52
+ optional :_links, Amocrm::Internal::Type::Unknown
53
+
54
+ # @!attribute account_id
55
+ #
56
+ # @return [Integer, nil]
57
+ optional :account_id, Integer
58
+
59
+ # @!attribute request_id
60
+ # Echoed request id
61
+ #
62
+ # @return [String, nil]
63
+ optional :request_id, String
64
+
65
+ # @!attribute uid
66
+ #
67
+ # @return [String, nil]
68
+ optional :uid, String
69
+
70
+ # @!method initialize(_embedded: nil, _links: nil, account_id: nil, request_id: nil, uid: nil)
71
+ # @param _embedded [Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded]
72
+ #
73
+ # @param _links [Object]
74
+ #
75
+ # @param account_id [Integer]
76
+ #
77
+ # @param request_id [String] Echoed request id
78
+ #
79
+ # @param uid [String]
80
+
81
+ # @see Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted#_embedded
82
+ class Embedded < Amocrm::Internal::Type::BaseModel
83
+ # @!attribute companies
84
+ #
85
+ # @return [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Company>, nil]
86
+ optional :companies,
87
+ -> do
88
+ Amocrm::Internal::Type::ArrayOf[
89
+ Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Company
90
+ ]
91
+ end
92
+
93
+ # @!attribute contacts
94
+ #
95
+ # @return [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Contact>, nil]
96
+ optional :contacts,
97
+ -> do
98
+ Amocrm::Internal::Type::ArrayOf[
99
+ Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Contact
100
+ ]
101
+ end
102
+
103
+ # @!attribute leads
104
+ #
105
+ # @return [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Lead>, nil]
106
+ optional :leads,
107
+ -> do
108
+ Amocrm::Internal::Type::ArrayOf[
109
+ Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Lead
110
+ ]
111
+ end
112
+
113
+ # @!method initialize(companies: nil, contacts: nil, leads: nil)
114
+ # @param companies [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Company>]
115
+ # @param contacts [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Contact>]
116
+ # @param leads [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse::Embedded::Unsorted::Embedded::Lead>]
117
+
118
+ class Company < Amocrm::Internal::Type::BaseModel
119
+ # @!attribute id
120
+ #
121
+ # @return [Integer, nil]
122
+ optional :id, Integer
123
+
124
+ # @!attribute _links
125
+ #
126
+ # @return [Object, nil]
127
+ optional :_links, Amocrm::Internal::Type::Unknown
128
+
129
+ # @!method initialize(id: nil, _links: nil)
130
+ # @param id [Integer]
131
+ # @param _links [Object]
132
+ end
133
+
134
+ class Contact < Amocrm::Internal::Type::BaseModel
135
+ # @!attribute id
136
+ #
137
+ # @return [Integer, nil]
138
+ optional :id, Integer
139
+
140
+ # @!attribute _links
141
+ #
142
+ # @return [Object, nil]
143
+ optional :_links, Amocrm::Internal::Type::Unknown
144
+
145
+ # @!method initialize(id: nil, _links: nil)
146
+ # @param id [Integer]
147
+ # @param _links [Object]
148
+ end
149
+
150
+ class Lead < Amocrm::Internal::Type::BaseModel
151
+ # @!attribute id
152
+ #
153
+ # @return [Integer, nil]
154
+ optional :id, Integer
155
+
156
+ # @!attribute _links
157
+ #
158
+ # @return [Object, nil]
159
+ optional :_links, Amocrm::Internal::Type::Unknown
160
+
161
+ # @!method initialize(id: nil, _links: nil)
162
+ # @param id [Integer]
163
+ # @param _links [Object]
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
169
+
170
+ class Problem < Amocrm::Internal::Type::BaseModel
171
+ # @!attribute detail
172
+ #
173
+ # @return [String, nil]
174
+ optional :detail, String
175
+
176
+ # @!attribute status
177
+ #
178
+ # @return [Integer, nil]
179
+ optional :status, Integer
180
+
181
+ # @!attribute title
182
+ #
183
+ # @return [String, nil]
184
+ optional :title, String
185
+
186
+ # @!attribute type
187
+ #
188
+ # @return [String, nil]
189
+ optional :type, String
190
+
191
+ # @!method initialize(detail: nil, status: nil, title: nil, type: nil)
192
+ # @param detail [String]
193
+ # @param status [Integer]
194
+ # @param title [String]
195
+ # @param type [String]
196
+ end
197
+
198
+ # @!method self.variants
199
+ # @return [Array(Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse, Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::Problem)]
200
+ end
201
+ end
202
+ end
203
+ end
204
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ module Models
5
+ module V4
6
+ module Leads
7
+ # @see Amocrm::Resources::V4::Leads::Unsorted#decline
8
+ class UnsortedDeclineParams < Amocrm::Internal::Type::BaseModel
9
+ extend Amocrm::Internal::Type::RequestParameters::Converter
10
+ include Amocrm::Internal::Type::RequestParameters
11
+
12
+ # @!attribute user_id
13
+ # User id on whose behalf the item is declined
14
+ #
15
+ # @return [Integer, nil]
16
+ optional :user_id, Integer
17
+
18
+ # @!method initialize(user_id: nil, request_options: {})
19
+ # @param user_id [Integer] User id on whose behalf the item is declined
20
+ #
21
+ # @param request_options [Amocrm::RequestOptions, Hash{Symbol=>Object}]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,172 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ module Models
5
+ module V4
6
+ module Leads
7
+ # @see Amocrm::Resources::V4::Leads::Unsorted#decline
8
+ module UnsortedDeclineResponse
9
+ extend Amocrm::Internal::Type::Union
10
+
11
+ variant -> { Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse }
12
+
13
+ variant -> { Amocrm::Models::V4::Leads::UnsortedDeclineResponse::Problem }
14
+
15
+ class UnsortedAcceptResponse < Amocrm::Internal::Type::BaseModel
16
+ # @!attribute _embedded
17
+ #
18
+ # @return [Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded, nil]
19
+ optional :_embedded,
20
+ -> { Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded }
21
+
22
+ # @!attribute category
23
+ #
24
+ # @return [Symbol, Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Category, nil]
25
+ optional :category,
26
+ enum: -> { Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Category }
27
+
28
+ # @!attribute created_at
29
+ #
30
+ # @return [Integer, nil]
31
+ optional :created_at, Integer
32
+
33
+ # @!attribute pipeline_id
34
+ #
35
+ # @return [Integer, nil]
36
+ optional :pipeline_id, Integer
37
+
38
+ # @!attribute uid
39
+ #
40
+ # @return [String, nil]
41
+ optional :uid, String
42
+
43
+ # @!method initialize(_embedded: nil, category: nil, created_at: nil, pipeline_id: nil, uid: nil)
44
+ # @param _embedded [Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded]
45
+ # @param category [Symbol, Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Category]
46
+ # @param created_at [Integer]
47
+ # @param pipeline_id [Integer]
48
+ # @param uid [String]
49
+
50
+ # @see Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse#_embedded
51
+ class Embedded < Amocrm::Internal::Type::BaseModel
52
+ # @!attribute companies
53
+ #
54
+ # @return [Array<Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Company>, nil]
55
+ optional :companies,
56
+ -> { Amocrm::Internal::Type::ArrayOf[Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Company] }
57
+
58
+ # @!attribute contacts
59
+ #
60
+ # @return [Array<Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Contact>, nil]
61
+ optional :contacts,
62
+ -> { Amocrm::Internal::Type::ArrayOf[Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Contact] }
63
+
64
+ # @!attribute leads
65
+ #
66
+ # @return [Array<Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Lead>, nil]
67
+ optional :leads,
68
+ -> { Amocrm::Internal::Type::ArrayOf[Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Lead] }
69
+
70
+ # @!method initialize(companies: nil, contacts: nil, leads: nil)
71
+ # @param companies [Array<Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Company>]
72
+ # @param contacts [Array<Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Contact>]
73
+ # @param leads [Array<Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse::Embedded::Lead>]
74
+
75
+ class Company < Amocrm::Internal::Type::BaseModel
76
+ # @!attribute id
77
+ #
78
+ # @return [Integer, nil]
79
+ optional :id, Integer
80
+
81
+ # @!attribute _links
82
+ #
83
+ # @return [Object, nil]
84
+ optional :_links, Amocrm::Internal::Type::Unknown
85
+
86
+ # @!method initialize(id: nil, _links: nil)
87
+ # @param id [Integer]
88
+ # @param _links [Object]
89
+ end
90
+
91
+ class Contact < Amocrm::Internal::Type::BaseModel
92
+ # @!attribute id
93
+ #
94
+ # @return [Integer, nil]
95
+ optional :id, Integer
96
+
97
+ # @!attribute _links
98
+ #
99
+ # @return [Object, nil]
100
+ optional :_links, Amocrm::Internal::Type::Unknown
101
+
102
+ # @!method initialize(id: nil, _links: nil)
103
+ # @param id [Integer]
104
+ # @param _links [Object]
105
+ end
106
+
107
+ class Lead < Amocrm::Internal::Type::BaseModel
108
+ # @!attribute id
109
+ #
110
+ # @return [Integer, nil]
111
+ optional :id, Integer
112
+
113
+ # @!attribute _links
114
+ #
115
+ # @return [Object, nil]
116
+ optional :_links, Amocrm::Internal::Type::Unknown
117
+
118
+ # @!method initialize(id: nil, _links: nil)
119
+ # @param id [Integer]
120
+ # @param _links [Object]
121
+ end
122
+ end
123
+
124
+ # @see Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse#category
125
+ module Category
126
+ extend Amocrm::Internal::Type::Enum
127
+
128
+ SIP = :sip
129
+ MAIL = :mail
130
+ CHATS = :chats
131
+ FORMS = :forms
132
+
133
+ # @!method self.values
134
+ # @return [Array<Symbol>]
135
+ end
136
+ end
137
+
138
+ class Problem < Amocrm::Internal::Type::BaseModel
139
+ # @!attribute detail
140
+ #
141
+ # @return [String, nil]
142
+ optional :detail, String
143
+
144
+ # @!attribute status
145
+ #
146
+ # @return [Integer, nil]
147
+ optional :status, Integer
148
+
149
+ # @!attribute title
150
+ #
151
+ # @return [String, nil]
152
+ optional :title, String
153
+
154
+ # @!attribute type
155
+ #
156
+ # @return [String, nil]
157
+ optional :type, String
158
+
159
+ # @!method initialize(detail: nil, status: nil, title: nil, type: nil)
160
+ # @param detail [String]
161
+ # @param status [Integer]
162
+ # @param title [String]
163
+ # @param type [String]
164
+ end
165
+
166
+ # @!method self.variants
167
+ # @return [Array(Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse, Amocrm::Models::V4::Leads::UnsortedDeclineResponse::Problem)]
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ [Amocrm::Internal::Type::BaseModel, *Amocrm::Internal::Type::BaseModel.subclasses].each do |cls|
5
+ cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, Amocrm::Internal::AnyHash) } }
6
+ end
7
+
8
+ Amocrm::Internal::Util.walk_namespaces(Amocrm::Models).each do |mod|
9
+ case mod
10
+ in Amocrm::Internal::Type::Enum | Amocrm::Internal::Type::Union
11
+ mod.constants.each do |name|
12
+ case mod.const_get(name)
13
+ in true | false
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
15
+ mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
16
+ in Integer
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
18
+ mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
+ in Float
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
21
+ mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
+ in Symbol
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
24
+ mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
+ else
26
+ end
27
+ end
28
+ else
29
+ end
30
+ end
31
+
32
+ Amocrm::Internal::Util.walk_namespaces(Amocrm::Models)
33
+ .lazy
34
+ .grep(Amocrm::Internal::Type::Union)
35
+ .each do |mod|
36
+ const = :Variants
37
+ next if mod.sorbet_constant_defined?(const)
38
+
39
+ mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
40
+ end
41
+
42
+ V4 = Amocrm::Models::V4
43
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ # Specify HTTP behaviour to use for a specific request. These options supplement
5
+ # or override those provided at the client level.
6
+ #
7
+ # When making a request, you can pass an actual {RequestOptions} instance, or
8
+ # simply pass a Hash with symbol keys matching the attributes on this class.
9
+ class RequestOptions < Amocrm::Internal::Type::BaseModel
10
+ # @api private
11
+ #
12
+ # @param opts [Amocrm::RequestOptions, Hash{Symbol=>Object}]
13
+ #
14
+ # @raise [ArgumentError]
15
+ def self.validate!(opts)
16
+ case opts
17
+ in Amocrm::RequestOptions | Hash
18
+ opts.to_h.each_key do |k|
19
+ unless fields.include?(k)
20
+ raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}")
21
+ end
22
+ end
23
+ else
24
+ raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}")
25
+ end
26
+ end
27
+
28
+ # @!attribute idempotency_key
29
+ # Idempotency key to send with request and all associated retries. Will only be
30
+ # sent for write requests.
31
+ #
32
+ # @return [String, nil]
33
+ optional :idempotency_key, String
34
+
35
+ # @!attribute extra_query
36
+ # Extra query params to send with the request. These are `.merge`’d into any
37
+ # `query` given at the client level.
38
+ #
39
+ # @return [Hash{String=>Array<String>, String, nil}, nil]
40
+ optional :extra_query, Amocrm::Internal::Type::HashOf[Amocrm::Internal::Type::ArrayOf[String]]
41
+
42
+ # @!attribute extra_headers
43
+ # Extra headers to send with the request. These are `.merged`’d into any
44
+ # `extra_headers` given at the client level.
45
+ #
46
+ # @return [Hash{String=>String, nil}, nil]
47
+ optional :extra_headers, Amocrm::Internal::Type::HashOf[String, nil?: true]
48
+
49
+ # @!attribute extra_body
50
+ # Extra data to send with the request. These are deep merged into any data
51
+ # generated as part of the normal request.
52
+ #
53
+ # @return [Object, nil]
54
+ optional :extra_body, Amocrm::Internal::Type::HashOf[Amocrm::Internal::Type::Unknown]
55
+
56
+ # @!attribute max_retries
57
+ # Maximum number of retries to attempt after a failed initial request.
58
+ #
59
+ # @return [Integer, nil]
60
+ optional :max_retries, Integer
61
+
62
+ # @!attribute timeout
63
+ # Request timeout in seconds.
64
+ #
65
+ # @return [Float, nil]
66
+ optional :timeout, Float
67
+
68
+ # @!method initialize(values = {})
69
+ # Returns a new instance of RequestOptions.
70
+ #
71
+ # @param values [Hash{Symbol=>Object}]
72
+
73
+ define_sorbet_constant!(:OrHash) do
74
+ T.type_alias { T.any(Amocrm::RequestOptions, Amocrm::Internal::AnyHash) }
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ module Resources
5
+ class V4
6
+ class Leads
7
+ class Unsorted
8
+ # @overload accept(uid, status_id: nil, user_id: nil, request_options: {})
9
+ #
10
+ # @param uid [String]
11
+ #
12
+ # @param status_id [Integer] Status id for the created lead
13
+ #
14
+ # @param user_id [Integer] User id on whose behalf the item is accepted
15
+ #
16
+ # @param request_options [Amocrm::RequestOptions, Hash{Symbol=>Object}, nil]
17
+ #
18
+ # @return [Amocrm::Models::V4::Leads::UnsortedAcceptResponse::UnsortedAcceptResponse, Amocrm::Models::V4::Leads::UnsortedAcceptResponse::Problem]
19
+ #
20
+ # @see Amocrm::Models::V4::Leads::UnsortedAcceptParams
21
+ def accept(uid, params = {})
22
+ parsed, options = Amocrm::V4::Leads::UnsortedAcceptParams.dump_request(params)
23
+ @client.request(
24
+ method: :post,
25
+ path: ["api/v4/leads/unsorted/%1$s/accept", uid],
26
+ body: parsed,
27
+ model: Amocrm::Models::V4::Leads::UnsortedAcceptResponse,
28
+ options: options
29
+ )
30
+ end
31
+
32
+ # @overload create_forms(body:, request_options: {})
33
+ #
34
+ # @param body [Array<Amocrm::Models::V4::Leads::UnsortedCreateFormsParams::Body>]
35
+ # @param request_options [Amocrm::RequestOptions, Hash{Symbol=>Object}, nil]
36
+ #
37
+ # @return [Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::UnsortedCreateResponse, Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse::Problem]
38
+ #
39
+ # @see Amocrm::Models::V4::Leads::UnsortedCreateFormsParams
40
+ def create_forms(params)
41
+ parsed, options = Amocrm::V4::Leads::UnsortedCreateFormsParams.dump_request(params)
42
+ @client.request(
43
+ method: :post,
44
+ path: "api/v4/leads/unsorted/forms",
45
+ body: parsed[:body],
46
+ model: Amocrm::Models::V4::Leads::UnsortedCreateFormsResponse,
47
+ options: options
48
+ )
49
+ end
50
+
51
+ # @overload decline(uid, user_id: nil, request_options: {})
52
+ #
53
+ # @param uid [String]
54
+ #
55
+ # @param user_id [Integer] User id on whose behalf the item is declined
56
+ #
57
+ # @param request_options [Amocrm::RequestOptions, Hash{Symbol=>Object}, nil]
58
+ #
59
+ # @return [Amocrm::Models::V4::Leads::UnsortedDeclineResponse::UnsortedAcceptResponse, Amocrm::Models::V4::Leads::UnsortedDeclineResponse::Problem]
60
+ #
61
+ # @see Amocrm::Models::V4::Leads::UnsortedDeclineParams
62
+ def decline(uid, params = {})
63
+ parsed, options = Amocrm::V4::Leads::UnsortedDeclineParams.dump_request(params)
64
+ @client.request(
65
+ method: :delete,
66
+ path: ["api/v4/leads/unsorted/%1$s/decline", uid],
67
+ body: parsed,
68
+ model: Amocrm::Models::V4::Leads::UnsortedDeclineResponse,
69
+ options: options
70
+ )
71
+ end
72
+
73
+ # @api private
74
+ #
75
+ # @param client [Amocrm::Client]
76
+ def initialize(client:)
77
+ @client = client
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ module Resources
5
+ class V4
6
+ class Leads
7
+ # @return [Amocrm::Resources::V4::Leads::Unsorted]
8
+ attr_reader :unsorted
9
+
10
+ # @api private
11
+ #
12
+ # @param client [Amocrm::Client]
13
+ def initialize(client:)
14
+ @client = client
15
+ @unsorted = Amocrm::Resources::V4::Leads::Unsorted.new(client: client)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ module Resources
5
+ class V4
6
+ # @return [Amocrm::Resources::V4::Leads]
7
+ attr_reader :leads
8
+
9
+ # @api private
10
+ #
11
+ # @param client [Amocrm::Client]
12
+ def initialize(client:)
13
+ @client = client
14
+ @leads = Amocrm::Resources::V4::Leads.new(client: client)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amocrm
4
+ VERSION = "0.1.0"
5
+ end