Skip to content

Commit 50a803f

Browse files
committed
Added synchronous option
1 parent 76180ef commit 50a803f

File tree

1 file changed

+194
-1
lines changed

1 file changed

+194
-1
lines changed

src/main/java/com/blockscore/net/BlockscoreApiClient.java

Lines changed: 194 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ public Observable<Verification> createVerification(@NotNull final Person person)
119119
return mRestAdapter.createVerification(person);
120120
}
121121

122+
/**
123+
* Creates a new verification.
124+
* @see com.blockscore.net.BlockscoreRetrofitAPI#createVerification(com.blockscore.models.Person)
125+
* @param person Person to verify.
126+
* @return Verification
127+
*/
128+
@NotNull
129+
public Verification createVerificationSync(@NotNull final Person person) {
130+
return mRestAdapter.createVerification(person).toBlocking().first();
131+
}
132+
122133
/**
123134
* Pulls up a single verification.
124135
* @see com.blockscore.net.BlockscoreRetrofitAPI#getVerification(String, retrofit.Callback)
@@ -140,6 +151,17 @@ public Observable<Verification> getVerification(@NotNull final String id) {
140151
return mRestAdapter.getVerification(id);
141152
}
142153

154+
/**
155+
* Pulls up a single verification.
156+
* @see com.blockscore.net.BlockscoreRetrofitAPI#getVerification(String)
157+
* @param id ID of verification to verify.
158+
* @return Verification
159+
*/
160+
@NotNull
161+
public Verification getVerificationSync(@NotNull final String id) {
162+
return mRestAdapter.getVerification(id).toBlocking().first();
163+
}
164+
143165
/**
144166
* Gets a list of verifications.
145167
* @see com.blockscore.net.BlockscoreRetrofitAPI#listVerifications(retrofit.Callback)
@@ -159,6 +181,16 @@ public Observable<List<Verification>> listVerifications() {
159181
return mRestAdapter.listVerifications();
160182
}
161183

184+
/**
185+
* Gets a list of verifications.
186+
* @see com.blockscore.net.BlockscoreRetrofitAPI#listVerifications()
187+
* @return The list of verification results.
188+
*/
189+
@NotNull
190+
public List<Verification> listVerificationsSync() {
191+
return mRestAdapter.listVerifications().toBlocking().first();
192+
}
193+
162194
/**
163195
* Creates a question set.
164196
* @see com.blockscore.net.BlockscoreRetrofitAPI#createQuestionSet(com.blockscore.models.request.QuestionSetRequest, retrofit.Callback)
@@ -181,6 +213,17 @@ public Observable<QuestionSet> createQuestionSet(@NotNull final QuestionSetReque
181213
return mRestAdapter.createQuestionSet(request);
182214
}
183215

216+
/**
217+
* Creates a question set.
218+
* @see com.blockscore.net.BlockscoreRetrofitAPI#createQuestionSet(com.blockscore.models.request.QuestionSetRequest)
219+
* @param request Question set request.
220+
* @return The question set.
221+
*/
222+
@NotNull
223+
public QuestionSet createQuestionSetSync(@NotNull final QuestionSetRequest request) {
224+
return mRestAdapter.createQuestionSet(request).toBlocking().first();
225+
}
226+
184227
/**
185228
* Scores a question set.
186229
* @see com.blockscore.net.BlockscoreRetrofitAPI#scoreQuestionSet(String, com.blockscore.models.request.AnswerRequest, retrofit.Callback)
@@ -207,6 +250,19 @@ public Observable<QuestionSet> scoreQuestionSet(@NotNull final String questionSe
207250
return mRestAdapter.scoreQuestionSet(questionSetId, answers);
208251
}
209252

253+
/**
254+
* Scores a question set.
255+
* @see com.blockscore.net.BlockscoreRetrofitAPI#scoreQuestionSet(String, com.blockscore.models.request.AnswerRequest)
256+
* @param questionSetId Question set ID
257+
* @param answers Answers to questions
258+
* @return Observable containing the question set.
259+
*/
260+
@NotNull
261+
public QuestionSet scoreQuestionSetSync(@NotNull final String questionSetId
262+
, @NotNull final AnswerRequest answers) {
263+
return mRestAdapter.scoreQuestionSet(questionSetId, answers).toBlocking().first();
264+
}
265+
210266
/**
211267
* This allows you to retrieve a question set you have created.
212268
* @see com.blockscore.net.BlockscoreRetrofitAPI#getQuestionSet(String, retrofit.Callback)
@@ -228,6 +284,16 @@ public Observable<QuestionSet> getQuestionSet(@NotNull final String questionSetI
228284
return mRestAdapter.getQuestionSet(questionSetId);
229285
}
230286

287+
/**
288+
* This allows you to retrieve a question set you have created.
289+
* @see com.blockscore.net.BlockscoreRetrofitAPI#getQuestionSet(String)
290+
* @param questionSetId Question set ID
291+
* @return The question set.
292+
*/
293+
public QuestionSet getQuestionSetSync(@NotNull final String questionSetId) {
294+
return mRestAdapter.getQuestionSet(questionSetId).toBlocking().first();
295+
}
296+
231297
/**
232298
* This allows you to retrieve a question set you have created.
233299
* @see com.blockscore.net.BlockscoreRetrofitAPI#listQuestionSets(retrofit.Callback)
@@ -247,6 +313,16 @@ public Observable<List<QuestionSet>> listQuestionSet() {
247313
return mRestAdapter.listQuestionSets();
248314
}
249315

316+
/**
317+
* This allows you to retrieve a question set you have created.
318+
* @see BlockscoreRetrofitAPI#listQuestionSets()
319+
* @return List of question sets.
320+
*/
321+
@NotNull
322+
public List<QuestionSet> listQuestionSetSync() {
323+
return mRestAdapter.listQuestionSets().toBlocking().first();
324+
}
325+
250326
/**
251327
* Creates a company.
252328
* @see com.blockscore.net.BlockscoreRetrofitAPI#createCompany(com.blockscore.models.Company, retrofit.Callback)
@@ -268,6 +344,17 @@ public Observable<Company> createCompany(@NotNull final Company company) {
268344
return mRestAdapter.createCompany(company);
269345
}
270346

347+
/**
348+
* Creates a company.
349+
* @see com.blockscore.net.BlockscoreRetrofitAPI#createCompany(com.blockscore.models.Company)
350+
* @param company Company to create.
351+
* @return Company.
352+
*/
353+
@NotNull
354+
public Company createCompanySync(@NotNull final Company company) {
355+
return mRestAdapter.createCompany(company).toBlocking().first();
356+
}
357+
271358
/**
272359
* Retrieves a company.
273360
* @see com.blockscore.net.BlockscoreRetrofitAPI#createCompany(com.blockscore.models.Company, retrofit.Callback)
@@ -289,6 +376,17 @@ public Observable<Company> getCompany(@NotNull final String id) {
289376
return mRestAdapter.getCompany(id);
290377
}
291378

379+
/**
380+
* Retrieves a company.
381+
* @see com.blockscore.net.BlockscoreRetrofitAPI#createCompany(com.blockscore.models.Company)
382+
* @param id Company ID.
383+
* @return Company.
384+
*/
385+
@NotNull
386+
public Company getCompanySync(@NotNull final String id) {
387+
return mRestAdapter.getCompany(id).toBlocking().first();
388+
}
389+
292390
/**
293391
* Lists your verified companies.
294392
* @see com.blockscore.net.BlockscoreRetrofitAPI#listCompanies(retrofit.Callback)
@@ -308,6 +406,16 @@ public Observable<List<Company>> listCompanies() {
308406
return mRestAdapter.listCompanies();
309407
}
310408

409+
/**
410+
* Lists your verified companies.
411+
* @see BlockscoreRetrofitAPI#listCompanies()
412+
* @return List of companies.
413+
*/
414+
@NotNull
415+
public List<Company> listCompaniesSync() {
416+
return mRestAdapter.listCompanies().toBlocking().first();
417+
}
418+
311419
/**
312420
* Creates a watchlist candidate.
313421
* @see com.blockscore.net.BlockscoreRetrofitAPI#createWatchlistCandidate(com.blockscore.models.WatchlistCandidate, retrofit.Callback)
@@ -330,6 +438,17 @@ public Observable<WatchlistCandidate> createWatchlistCandidate(@NotNull final Wa
330438
return mRestAdapter.createWatchlistCandidate(candidate);
331439
}
332440

441+
/**
442+
* Creates a watchlist candidate.
443+
* @see com.blockscore.net.BlockscoreRetrofitAPI#createWatchlistCandidate(com.blockscore.models.WatchlistCandidate)
444+
* @param candidate Watchlist candidate to create.
445+
* @return Candidate.
446+
*/
447+
@NotNull
448+
public WatchlistCandidate createWatchlistCandidateSync(@NotNull final WatchlistCandidate candidate) {
449+
return mRestAdapter.createWatchlistCandidate(candidate).toBlocking().first();
450+
}
451+
333452
/**
334453
* Updates a watchlist candidate.
335454
* @see com.blockscore.net.BlockscoreRetrofitAPI#updateWatchlistCandidate(String, com.blockscore.models.WatchlistCandidate, retrofit.Callback)
@@ -355,6 +474,19 @@ public Observable<WatchlistCandidate> updateWatchlistCandidate(@NotNull final St
355474
return mRestAdapter.updateWatchlistCandidate(id, candidate);
356475
}
357476

477+
/**
478+
* Updates a watchlist candidate.
479+
* @see com.blockscore.net.BlockscoreRetrofitAPI#updateWatchlistCandidate(String, com.blockscore.models.WatchlistCandidate)
480+
* @param id ID for the candidate.
481+
* @param candidate Watchlist candidate to create.
482+
* @return Candidate.
483+
*/
484+
@NotNull
485+
public WatchlistCandidate updateWatchlistCandidateSync(@NotNull final String id
486+
, @NotNull final WatchlistCandidate candidate) {
487+
return mRestAdapter.updateWatchlistCandidate(id, candidate).toBlocking().first();
488+
}
489+
358490
/**
359491
* Gets a watchlist candidate.
360492
* @see com.blockscore.net.BlockscoreRetrofitAPI#getWatchlistCandidate(String, retrofit.Callback)
@@ -369,13 +501,24 @@ public void getWatchlistCandidate(@NotNull final String id, @NotNull final Callb
369501
* Gets a watchlist candidate.
370502
* @see com.blockscore.net.BlockscoreRetrofitAPI#getWatchlistCandidate(String)
371503
* @param id ID for the candidate.
372-
* @return Obsercable containing the candidate
504+
* @return Observable containing the candidate
373505
*/
374506
@NotNull
375507
public Observable<WatchlistCandidate> getWatchlistCandidate(@NotNull final String id) {
376508
return mRestAdapter.getWatchlistCandidate(id);
377509
}
378510

511+
/**
512+
* Gets a watchlist candidate.
513+
* @see com.blockscore.net.BlockscoreRetrofitAPI#getWatchlistCandidate(String)
514+
* @param id ID for the candidate.
515+
* @return Candidate
516+
*/
517+
@NotNull
518+
public WatchlistCandidate getWatchlistCandidateSync(@NotNull final String id) {
519+
return mRestAdapter.getWatchlistCandidate(id).toBlocking().first();
520+
}
521+
379522
/**
380523
* Lists the watchlist candidates.
381524
* @see BlockscoreRetrofitAPI#listWatchlistCandidate(retrofit.Callback)
@@ -395,6 +538,16 @@ public Observable<List<WatchlistCandidate>> listWatchlistCandidate() {
395538
return mRestAdapter.listWatchlistCandidate();
396539
}
397540

541+
/**
542+
* Lists the watchlist candidates.
543+
* @see BlockscoreRetrofitAPI#listWatchlistCandidate()
544+
* @return Response.
545+
*/
546+
@NotNull
547+
public List<WatchlistCandidate> listWatchlistCandidateSync() {
548+
return mRestAdapter.listWatchlistCandidate().toBlocking().first();
549+
}
550+
398551
/**
399552
* Gets the watchlist candidate's history.
400553
* @param id ID for the candidate.
@@ -415,6 +568,16 @@ public Observable<List<WatchlistCandidate>> getWatchlistCandidateHistory(@NotNul
415568
return mRestAdapter.getWatchlistCandidateHistory(id);
416569
}
417570

571+
/**
572+
* Gets the watchlist candidate's history.
573+
* @param id ID for the candidate.
574+
* @return List of watchlist candidates.
575+
*/
576+
@NotNull
577+
public List<WatchlistCandidate> getWatchlistCandidateHistorySync(@NotNull final String id) {
578+
return mRestAdapter.getWatchlistCandidateHistory(id).toBlocking().first();
579+
}
580+
418581
/**
419582
* Deletes a watchlist candidate.
420583
* @param id ID for the candidate.
@@ -435,6 +598,16 @@ public Observable<WatchlistCandidate> deleteWatchlistCandidate(@NotNull final St
435598
return mRestAdapter.deleteWatchlistCandidate(id);
436599
}
437600

601+
/**
602+
* Deletes a watchlist candidate.
603+
* @param id ID for the candidate.
604+
* @return Watchlist candidate.
605+
*/
606+
@NotNull
607+
public WatchlistCandidate deleteWatchlistCandidateSync(@NotNull final String id) {
608+
return mRestAdapter.deleteWatchlistCandidate(id).toBlocking().first();
609+
}
610+
438611
/**
439612
* Gets the hits for a watchlist candidate.
440613
* @param id ID for the candidate.
@@ -455,6 +628,16 @@ public Observable<List<WatchlistHit>> getWatchlistCandidateHits(@NotNull final S
455628
return mRestAdapter.getWatchlistCandidateHits(id);
456629
}
457630

631+
/**
632+
* Gets the hits for a watchlist candidate.
633+
* @param id ID for the candidate.
634+
* @return List of watchlist hits.
635+
*/
636+
@NotNull
637+
public List<WatchlistHit> getWatchlistCandidateHitsSync(@NotNull final String id) {
638+
return mRestAdapter.getWatchlistCandidateHits(id).toBlocking().first();
639+
}
640+
458641
/**
459642
* Searches watchlists for a given candidate.
460643
* @param searchRequest Search request to complete
@@ -475,6 +658,16 @@ public Observable<WatchlistSearchResults> searchWatchlists(@NotNull final Search
475658
return mRestAdapter.searchWatchlists(searchRequest);
476659
}
477660

661+
/**
662+
* Searches watchlists for a given candidate.
663+
* @param searchRequest Search request to complete
664+
* @return Watch list search results.
665+
*/
666+
@NotNull
667+
public WatchlistSearchResults searchWatchlistsSync(@NotNull final SearchRequest searchRequest) {
668+
return mRestAdapter.searchWatchlists(searchRequest).toBlocking().first();
669+
}
670+
478671
/**
479672
* Encodes the API key for Basic authentication.
480673
* @return API key encoded with Base 64.

0 commit comments

Comments
 (0)