Search in sources :

Example 6 with Order

use of com.google.api.ads.admanager.axis.v202205.Order in project pwinty-java-sdk by OddPrints.

the class OrderUpdater method addPhotoToOrder.

public void addPhotoToOrder(int orderIdToUpdate, URL newUrl, Photo.Type type, int copies, Photo.Sizing sizing) {
    Pwinty pwinty = getPwinty(environment);
    System.out.println(pwinty.getOrder(orderIdToUpdate));
    Order order = pwinty.getOrder(orderIdToUpdate);
    order.addPhoto(newUrl, type, copies, sizing);
}
Also used : Order(uk.co.mattburns.pwinty.v2_3.Order) Pwinty(uk.co.mattburns.pwinty.v2_3.Pwinty)

Example 7 with Order

use of com.google.api.ads.admanager.axis.v202205.Order in project pwinty-java-sdk by OddPrints.

the class OrderUpdater method updateImageUrl.

public void updateImageUrl(int orderIdToUpdate, int photoIdToUpdate, URL newUrl) {
    Pwinty pwinty = getPwinty(environment);
    System.out.println(pwinty.getOrder(orderIdToUpdate));
    Order order = pwinty.getOrder(orderIdToUpdate);
    List<Photo> photos = order.getPhotos();
    Photo.Type type = null;
    Photo.Sizing sizing = null;
    int copies = 0;
    for (Photo photo : photos) {
        if (photo.getId() == photoIdToUpdate) {
            type = photo.getType();
            sizing = photo.getSizing();
            copies = photo.getCopies();
            order.deletePhoto(photo);
        }
    }
    order.addPhoto(newUrl, type, copies, sizing);
}
Also used : Order(uk.co.mattburns.pwinty.v2_3.Order) Pwinty(uk.co.mattburns.pwinty.v2_3.Pwinty) Photo(uk.co.mattburns.pwinty.v2_3.Photo)

Example 8 with Order

use of com.google.api.ads.admanager.axis.v202205.Order in project pwinty-java-sdk by OddPrints.

the class OrderUpdater method display.

public void display(int orderId) {
    Pwinty pwinty = getPwinty(environment);
    Order order = pwinty.getOrder(orderId);
    System.out.println(order);
}
Also used : Order(uk.co.mattburns.pwinty.v2_6.Order) Pwinty(uk.co.mattburns.pwinty.v2_6.Pwinty)

Example 9 with Order

use of com.google.api.ads.admanager.axis.v202205.Order in project pwinty-java-sdk by OddPrints.

the class OrderUpdater method updateImageUrl.

public void updateImageUrl(int orderIdToUpdate, int photoIdToUpdate, URL newUrl) {
    Pwinty pwinty = getPwinty(environment);
    System.out.println(pwinty.getOrder(orderIdToUpdate));
    Order order = pwinty.getOrder(orderIdToUpdate);
    List<Photo> photos = order.getPhotos();
    Photo.Type type = null;
    Photo.Sizing sizing = null;
    int copies = 0;
    for (Photo photo : photos) {
        if (photo.getId() == photoIdToUpdate) {
            type = photo.getType();
            sizing = photo.getSizing();
            copies = photo.getCopies();
            order.deletePhoto(photo);
        }
    }
    order.addPhoto(newUrl, type, copies, sizing);
}
Also used : Order(uk.co.mattburns.pwinty.v2_6.Order) Pwinty(uk.co.mattburns.pwinty.v2_6.Pwinty) Photo(uk.co.mattburns.pwinty.v2_6.Photo)

Example 10 with Order

use of com.google.api.ads.admanager.axis.v202205.Order in project googleads-java-lib by googleads.

the class CreateOrders method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param advertiserId the ID of the advertiser (company) that all creatives will be assigned to.
 * @param traffickerId the ID of the trafficker (user) associated with this order.
 * @throws ApiException if the API request failed with one or more service errors.
 * @throws RemoteException if the API request failed due to other errors.
 */
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session, long advertiserId, long traffickerId) throws RemoteException {
    // Get the OrderService.
    OrderServiceInterface orderService = adManagerServices.get(session, OrderServiceInterface.class);
    // Create an order.
    Order order = new Order();
    order.setName("Order #" + new Random().nextInt(Integer.MAX_VALUE));
    order.setAdvertiserId(advertiserId);
    order.setTraffickerId(traffickerId);
    // Create the order on the server.
    Order[] orders = orderService.createOrders(new Order[] { order });
    for (Order createdOrder : orders) {
        System.out.printf("An order with ID %d and name '%s' was created.%n", createdOrder.getId(), createdOrder.getName());
    }
}
Also used : Order(com.google.api.ads.admanager.axis.v202202.Order) Random(java.util.Random) OrderServiceInterface(com.google.api.ads.admanager.axis.v202202.OrderServiceInterface)

Aggregations

Random (java.util.Random)7 Order (uk.co.mattburns.pwinty.v2_3.Order)7 Pwinty (uk.co.mattburns.pwinty.v2_3.Pwinty)7 Order (uk.co.mattburns.pwinty.v2_6.Order)7 Pwinty (uk.co.mattburns.pwinty.v2_6.Pwinty)7 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)6 Order (com.google.api.ads.admanager.axis.v202108.Order)5 OrderServiceInterface (com.google.api.ads.admanager.axis.v202108.OrderServiceInterface)5 Order (com.google.api.ads.admanager.axis.v202111.Order)5 OrderServiceInterface (com.google.api.ads.admanager.axis.v202111.OrderServiceInterface)5 Order (com.google.api.ads.admanager.axis.v202202.Order)5 OrderServiceInterface (com.google.api.ads.admanager.axis.v202202.OrderServiceInterface)5 Order (com.google.api.ads.admanager.axis.v202205.Order)5 OrderServiceInterface (com.google.api.ads.admanager.axis.v202205.OrderServiceInterface)5 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder)4 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder)4 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)4 OrderPage (com.google.api.ads.admanager.axis.v202108.OrderPage)4 OrderPage (com.google.api.ads.admanager.axis.v202111.OrderPage)4 OrderPage (com.google.api.ads.admanager.axis.v202202.OrderPage)4