@@ -13,19 +13,24 @@ var ErrEmptyAuthMaker = errors.New("authMaker is nil")
13
13
type CorporateAPI interface {
14
14
CommonAPI
15
15
16
- // Auth initializes access.
17
- // https://api.monobank.ua/docs/corporate.html#operation--personal-auth-request-post
16
+ // Settings returns information about company.
17
+ // https://api.monobank.ua/docs/corporate.html#tag/Avtorizaciya-ta-nalashtuvannya-kompaniyi/paths/~1personal~1corp~1settings/get
18
+ Settings (ctx context.Context ) (* CorpSettings , error )
19
+
20
+ // Auth initializes client access.
21
+ // https://api.monobank.ua/docs/corporate.html#tag/Kliyentski-personalni-dani/paths/~1personal~1auth~1request/post
18
22
Auth (ctx context.Context , callbackURL string , permissions ... string ) (* TokenRequest , error )
19
23
20
24
// CheckAuth checks status of request for client's personal data.
21
- // https://api.monobank.ua/docs/corporate.html#operation--personal-auth-request- get
25
+ // https://api.monobank.ua/docs/corporate.html#tag/Kliyentski-personalni-dani/paths/~1personal~1auth~1request/ get
22
26
CheckAuth (ctx context.Context , requestID string ) error
23
27
24
- // ClientInfo - https://api.monobank.ua/docs/corporate.html#operation--personal-client-info-get
28
+ // ClientInfo
29
+ // https://api.monobank.ua/docs/corporate.html#tag/Kliyentski-personalni-dani/paths/~1personal~1client-info/get
25
30
ClientInfo (ctx context.Context , requestID string ) (* ClientInfo , error )
26
31
27
32
// Transactions - gets bank account statements(transactions)
28
- // https://api.monobank.ua/docs/corporate.html#operation--personal-statement-- account--- from---to-- get
33
+ // https://api.monobank.ua/docs/corporate.html#tag/Kliyentski-personalni-dani/paths/~1personal~1statement~1{ account}~1{ from}~1{to}/ get
29
34
Transactions (ctx context.Context , requestID , accountID string , from , to time.Time ) (Transactions , error )
30
35
}
31
36
@@ -106,6 +111,22 @@ func (c CorporateClient) Transactions(ctx context.Context, requestID, accountID
106
111
return authClient .commonClient .Transactions (ctx , accountID , from , to )
107
112
}
108
113
114
+ func (c CorporateClient ) Settings (ctx context.Context ) (* CorpSettings , error ) {
115
+ const urlPath = "/personal/corp/settings"
116
+
117
+ authClient := c .withAuth (c .authMaker .New ("" ))
118
+
119
+ req , err := http .NewRequestWithContext (ctx , http .MethodGet , urlPath , http .NoBody )
120
+ if err != nil {
121
+ return nil , fmt .Errorf ("failed to create request: %w" , err )
122
+ }
123
+
124
+ var v CorpSettings
125
+ err = authClient .do (req , & v , http .StatusOK )
126
+
127
+ return & v , err
128
+ }
129
+
109
130
// withAuth returns copy of CorporateClient with authorizer
110
131
// TODO: remove?
111
132
func (c CorporateClient ) withAuth (auth Authorizer ) CorporateClient {
0 commit comments