1- using System . Text . Json ;
1+ using System . Net . Http . Json ;
2+ using System . Text . Json ;
23
34namespace TTMC . Kréta
45{
@@ -14,39 +15,210 @@ public EAdminApi(string accessToken, string domain = "e-kreta.hu")
1415 client . DefaultRequestHeaders . Add ( "X-Uzenet-Lokalizacio" , "hu-HU" ) ;
1516 client . DefaultRequestHeaders . Authorization = new ( "Bearer" , accessToken ) ;
1617 }
17- private TemporaryFile uploadAttachment ( string url , Stream stream , string fileName )
18+ public TemporaryFile createAttachment ( Stream stream , string fileName )
1819 {
1920 MultipartFormDataContent multipartFormDataContent = new ( ) ;
2021 StreamContent streamContent = new ( stream ) ;
2122 multipartFormDataContent . Add ( streamContent , "fajl" , fileName ) ;
22- HttpResponseMessage resp = client . PostAsync ( url , multipartFormDataContent ) . Result ;
23+ HttpResponseMessage resp = client . PostAsync ( "/api/v1/ideiglenesfajlok" , multipartFormDataContent ) . Result ;
2324 string json = resp . Content . ReadAsStringAsync ( ) . Result ;
2425 return Deserialize < TemporaryFile > ( json ) ;
2526 }
26- private TemporaryFile uploadAttachment ( string url , byte [ ] data , string fileName )
27+ public HttpContent createRectification ( string ugyId , RectificationPost rectificationPost )
2728 {
28- MultipartFormDataContent multipartFormDataContent = new ( ) ;
29- ByteArrayContent byteArrayContent = new ( data ) ;
30- multipartFormDataContent . Add ( byteArrayContent , "fajl" , fileName ) ;
31- HttpResponseMessage resp = client . PostAsync ( url , multipartFormDataContent ) . Result ;
29+ JsonContent jsonContent = JsonContent . Create ( rectificationPost , options : Engine . jsonSerializerOptions ) ;
30+ HttpResponseMessage resp = client . PostAsync ( $ "/api/v1/ugy/kerelmek/{ ugyId } ", jsonContent ) . Result ;
31+ return resp . Content ;
32+ }
33+ public HttpContent createTmgiCase ( TmgiCasePost tmgiCasePost )
34+ {
35+ JsonContent jsonContent = JsonContent . Create ( tmgiCasePost , options : Engine . jsonSerializerOptions ) ;
36+ HttpResponseMessage resp = client . PostAsync ( $ "/api/v1/ugy/kerelmek", jsonContent ) . Result ;
37+ return resp . Content ;
38+ }
39+ public HttpContent deleteMessagePermanently ( bool isKuka , params long [ ] postaladaElemAzonositok )
40+ {
41+ string temp = string . Empty ;
42+ foreach ( long value in postaladaElemAzonositok )
43+ {
44+ temp += "," + postaladaElemAzonositok ;
45+ }
46+ HttpResponseMessage resp = client . DeleteAsync ( $ "/api/v1/kommunikacio/postaladaelemek/torles?isKuka={ isKuka } &postaladaElemAzonositok={ temp [ 1 ..] } ") . Result ;
47+ return resp . Content ;
48+ }
49+ public HttpContent downloadAttachment ( string url )
50+ {
51+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/{ url } ") . Result ;
52+ return resp . Content ;
53+ }
54+ public List < AccessControlSystemItem > getAccessControlSystemEvents ( )
55+ {
56+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/belepteto/kartyaesemenyek/sajat") . Result ;
3257 string json = resp . Content . ReadAsStringAsync ( ) . Result ;
33- return Deserialize < TemporaryFile > ( json ) ;
58+ return Deserialize < List < AccessControlSystemItem > > ( json ) ;
3459 }
35- private TemporaryFile createAttachment ( Stream stream , string fileName )
60+ public List < KretaClass > getAddressableClasses ( string cimzettKod )
3661 {
37- MultipartFormDataContent multipartFormDataContent = new ( ) ;
38- StreamContent streamContent = new ( stream ) ;
39- multipartFormDataContent . Add ( streamContent , "fajl" , fileName ) ;
40- HttpResponseMessage resp = client . PostAsync ( "api/v1/ideiglenesfajlok" , multipartFormDataContent ) . Result ;
62+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kommunikacio/osztalyok/cimezheto?cimzettKod={ cimzettKod } ") . Result ;
4163 string json = resp . Content . ReadAsStringAsync ( ) . Result ;
42- return Deserialize < TemporaryFile > ( json ) ;
64+ return Deserialize < List < KretaClass > > ( json ) ;
65+ }
66+ public List < GuardianEAdmin > getAddressableGuardiansForClass ( long osztalyKretaAzonosito )
67+ {
68+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kreta/gondviselok/osztaly/{ osztalyKretaAzonosito } ") . Result ;
69+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
70+ return Deserialize < List < GuardianEAdmin > > ( json ) ;
71+ }
72+ public List < GuardianEAdmin > getAddressableSzmkRepesentative ( )
73+ {
74+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kommunikacio/szmkkepviselok/cimezheto") . Result ;
75+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
76+ return Deserialize < List < GuardianEAdmin > > ( json ) ;
77+ }
78+ public List < AddresseeType > getAddressableType ( )
79+ {
80+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kommunikacio/cimezhetotipusok") . Result ;
81+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
82+ return Deserialize < List < AddresseeType > > ( json ) ;
83+ }
84+ public List < AddresseeType > getAddresseeType ( )
85+ {
86+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/adatszotarak/cimzetttipusok") . Result ;
87+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
88+ return Deserialize < List < AddresseeType > > ( json ) ;
89+ }
90+ public List < EmployeeDetails > getAdministrators ( )
91+ {
92+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kreta/alkalmazottak/adminisztrator") . Result ;
93+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
94+ return Deserialize < List < EmployeeDetails > > ( json ) ;
95+ }
96+ public Case getCase ( string ugyId )
97+ {
98+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/ugy/kerelmek/{ ugyId } ") . Result ;
99+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
100+ return Deserialize < Case > ( json ) ;
101+ }
102+ public List < Type > getCaseTypes ( )
103+ {
104+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/adatszotarak/kerelemtipusok") . Result ;
105+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
106+ return Deserialize < List < Type > > ( json ) ;
107+ }
108+ public List < Case > getCases ( )
109+ {
110+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/ugy/kerelmek") . Result ;
111+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
112+ return Deserialize < List < Case > > ( json ) ;
113+ }
114+ public Child getChildData ( )
115+ {
116+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kreta/gyerekemadatok") . Result ;
117+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
118+ return Deserialize < Child > ( json ) ;
119+ }
120+ public List < EmployeeDetails > getClassMasters ( )
121+ {
122+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kreta/alkalmazottak/oszalyfonok") . Result ;
123+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
124+ return Deserialize < List < EmployeeDetails > > ( json ) ;
43125 }
44- private TemporaryFile createAttachment ( byte [ ] data , string fileName )
126+ public CurrentInstitutionDetails getCurrentInstitutionDetails ( )
127+ {
128+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/ugy/aktualisIntezmenyAdatok") . Result ;
129+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
130+ return Deserialize < CurrentInstitutionDetails > ( json ) ;
131+ }
132+ public List < string > getCurrentInstitutionModules ( )
133+ {
134+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/intezmenyek/sajat/modulok") . Result ;
135+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
136+ return Deserialize < List < string > > ( json ) ;
137+ }
138+ public List < EmployeeDetails > getDirectors ( )
139+ {
140+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kreta/alkalmazottak/igazgatosag") . Result ;
141+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
142+ return Deserialize < List < EmployeeDetails > > ( json ) ;
143+ }
144+ public MailboxItem getMessage ( long azonosito )
145+ {
146+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kommunikacio/postaladaelemek/{ azonosito } ") . Result ;
147+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
148+ return Deserialize < MailboxItem > ( json ) ;
149+ }
150+ public MessageLimitations getMessageLimitations ( )
151+ {
152+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kommunikacio/uzenetek/kuldhetok/korlat") . Result ;
153+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
154+ return Deserialize < MessageLimitations > ( json ) ;
155+ }
156+ public List < MailboxItem > getMessages ( )
157+ {
158+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kommunikacio/postaladaelemek/sajat") . Result ;
159+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
160+ return Deserialize < List < MailboxItem > > ( json ) ;
161+ }
162+ public Signer getSigner ( int kerelemAzonosito , int kretaAzonosito )
163+ {
164+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/ugy/alkalmazott/{ kerelemAzonosito } /{ kretaAzonosito } ") . Result ;
165+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
166+ return Deserialize < Signer > ( json ) ;
167+ }
168+ public Status getStatus ( )
169+ {
170+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/status") . Result ;
171+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
172+ return Deserialize < Status > ( json ) ;
173+ }
174+ public List < Guardian > getSzmk ( )
175+ {
176+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kommunikacio/szmkkepviselok/cimezheto") . Result ;
177+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
178+ return Deserialize < List < Guardian > > ( json ) ;
179+ }
180+ public List < EmployeeDetails > getTeachers ( )
181+ {
182+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kreta/alkalmazottak/tanar") . Result ;
183+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
184+ return Deserialize < List < EmployeeDetails > > ( json ) ;
185+ }
186+ public List < Type > getTmgiCaseTypes ( )
187+ {
188+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/adatszotarak/tmgiigazolastipusok") . Result ;
189+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
190+ return Deserialize < List < Type > > ( json ) ;
191+ }
192+ public int getUnreadMessagesCount ( )
193+ {
194+ HttpResponseMessage resp = client . GetAsync ( $ "/api/v1/kommunikacio/postaladaelemek/olvasatlanokszama") . Result ;
195+ string json = resp . Content . ReadAsStringAsync ( ) . Result ;
196+ return Deserialize < int > ( json ) ;
197+ }
198+ public HttpContent readMessage ( ReadMessageRequest readMessageRequest )
199+ {
200+ JsonContent jsonContent = JsonContent . Create ( readMessageRequest , options : Engine . jsonSerializerOptions ) ;
201+ HttpResponseMessage resp = client . PostAsync ( $ "/api/v1/kommunikacio/postaladaelemek/olvasott", jsonContent ) . Result ;
202+ return resp . Content ;
203+ }
204+ public HttpContent sendMessage ( Message message )
205+ {
206+ JsonContent jsonContent = JsonContent . Create ( message , options : Engine . jsonSerializerOptions ) ;
207+ HttpResponseMessage resp = client . PostAsync ( $ "/api/v1/kommunikacio/uzenetek", jsonContent ) . Result ;
208+ return resp . Content ;
209+ }
210+ public HttpContent sendMessageToBin ( SendMessageToBinRequest sendMessageToBinRequest )
211+ {
212+ JsonContent jsonContent = JsonContent . Create ( sendMessageToBinRequest , options : Engine . jsonSerializerOptions ) ;
213+ HttpResponseMessage resp = client . PostAsync ( $ "/api/v1/kommunikacio/postaladaelemek/kuka", jsonContent ) . Result ;
214+ return resp . Content ;
215+ }
216+ public TemporaryFile uploadAttachment ( string url , Stream stream , string fileName )
45217 {
46218 MultipartFormDataContent multipartFormDataContent = new ( ) ;
47- ByteArrayContent byteArrayContent = new ( data ) ;
48- multipartFormDataContent . Add ( byteArrayContent , "fajl" , fileName ) ;
49- HttpResponseMessage resp = client . PostAsync ( "api/v1/ideiglenesfajlok" , multipartFormDataContent ) . Result ;
219+ StreamContent streamContent = new ( stream ) ;
220+ multipartFormDataContent . Add ( streamContent , "fajl" , fileName ) ;
221+ HttpResponseMessage resp = client . PostAsync ( url , multipartFormDataContent ) . Result ;
50222 string json = resp . Content . ReadAsStringAsync ( ) . Result ;
51223 return Deserialize < TemporaryFile > ( json ) ;
52224 }
@@ -75,12 +247,6 @@ private T Deserialize<T>(string json)
75247 }
76248 }
77249 }
78- public class TemporaryFile
79- {
80- public string ? fajlAzonosito { get ; set ; }
81- public string ? utvonal { get ; set ; }
82- public long fajlMeretByteLength { get ; set ; }
83- }
84250 public class EAdminException
85251 {
86252 public string ? uzenet { get ; set ; }
0 commit comments