Flexible and easy to use java api for allegro service focused on trading operation on allegro platform.
- Java 8
- BD lib
git clone https://github.com/awronski/allegro-nice-api.git
cd allegro-nice-api
mvn package install
Tests are skipped by default during packaging because of bugs in allegro test environment.
If you want to run the test you have to rename test-credentions.template
to test-credentions.properties
and set the credentials.
Than run the tests:
mvn compile test -P testprof
int countryId = 1;
Configuration conf = new Configuration(countryId);
Credentials cred = new Credentials("username", "password", "key");
IAllegroNiceApi allegro = AllegroNiceApi.Builder()
.conf(conf)
.cred(cred)
.build();
allegro.login();
Observable<Auction> auctions = api.getAuctions();
long startingPoint = 0;
Observable<Deal> deals = api.getDeals(startingPoint);
Observable<Payment> payments - getPayments(deals);
You can subscribe to user's journal using api.getSiteJournal(startingPoint)
.
Like above methods this one returns Observable object too.
long startingPoint = 0;
api.getSiteJournal(startingPoint)
.subscribe(
j -> System.out.println("on next: " + j),
t -> System.out.println("on error: " + t),
() -> System.out.println("on complete")
);
Read more about RxJava.
To create new auction you need to create list of auctions fields.
Id of the field is the same as on the allegro service. Check getSellFormFields(categoryId)
to get
all possible fields for a given category.
List<NewAuctionField> fields = new ArrayList<>();
fields.add( new NewAuctionField(1, FieldType.Type.STRING, "Auction title") );
[...]
CreatedAuction created = api.createNewAuction(fields);
ChangedQty changedQty = api.changeQty(itemId, 5);
List<FinishAuctionFailure> failures = api.finishAuctions(List<Long> itemsIds);
int counter = api.getWaintingFeedbackCounter();
Observable<WaitingFeedback> api.getWaitingFeedbacks();
List<CreateFeedback> create = new ArrayList<>(..)
List<CreatedFeedback> = api.createFeedbacks(create)
List<AllegroMessage> msgs = allegro.getAllMessages(LocalDateTime.now().minusDays(30));
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.