Skip to content
This repository has been archived by the owner on Mar 25, 2019. It is now read-only.

awronski/allegro-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

allegro-client

Allegro-client is a client for allegro-server.

Requirements

Install

git clone https://github.com/awronski/allegro-client.git
cd allegro-client
mvn package install

How to use it?

Create an instance:

AllegroClient client = new AllegroClient.Builder()
    .endpoint(address)
    .username(user)
    .password(password)
    .logLevel(RestAdapter.LogLevel.NONE)
    .build();

Auctions

Performing operations on auction

IAuctionService auctionService = client.getAuctionService();

List<Auction> allAuctions = auctionService.getAllAuctions();
List<Auction> openAuctions = auctionService.getOpenAuctions(true);
Optional<Auction> auction = auctionService.getAuctionById(itemId);
ChangedQty changedQty = auctionService.changeQty(itemId, 9);
List<FinishAuctionFailure> failuresList = auctionService.finish(Arrays.asList(itemId1, itemId2, itemId3));

Creating new auction

List<NewAuctionField> fields = new AuctionBuilder()
        .category(76661)
        .title("Title")
        .city("Warszawa")
        .zip("01-111")
        .state(State.MAZOWIECKIE)
        .color(Color.BLACK)
        .desc("This is test description")
        .price(1.99)
        .priceForLetter(7.99)
        .priceForNextItemInLetter(0.0)
        .qtyInLetter(50)
        .priceForCourier(14.99)
        .priceForNextItemInCourier(0.0)
        .qtyInCourier(250)
        .build();
CreatedAuction createdAuction = auctionService.create(fields);

Payments

List<Payment> lastPayments = client.getPaymentService().getLastPayments(10);
List<Payment> unprocessed = client.getPaymentService()getUnprocessed();

PaymentProcessed processed = client.getPaymentService().process(transactionId, amount, yourRef);

Search Payments

List<Payment> payments = service.searchPayments(new SearchPayment.Builder()
        .withMsg(false)
        .withInvoice(false)
        .from(fromDate)
        .to(doDate))
        .limit(100)
        .build());

Journal

Date to = Date.from(LocalDateTime.now().minusDays(10).atZone(ZoneId.systemDefault()).toInstant());

SearchJournal searchJournal = new SearchJournal.Builder()
        .changeType(JournalType.CHANGE)
        .to(to)
        .build();

List<Journal> lastJournals = client.getJournalService().search(searchJournal);

Deals

List<Deal> lastDeals = client.getDealService().getLastDeals(10)

Feedbacks

List<WaitingFeedback> waitingFeedbacks = client.getFeedbackService().waitingFeedbackOnlyForPaidOrders();

List<CreateFeedback> feedbacks = new ArrayList<>(..);
List<CreatedFeedback> createdFeedbacks = client.getFeedbackService().create(feedbacks);

Categories' Forms

List<FormField> fields = client.getFormFieldService().getFormFields(76661, true);

... work in progress

License

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.

About

Allegro client for allegro-server project

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages