Categories
AI & Tech

How to generate Client side Java Client using Swagger Codegen?

Swagger (hyperlink to this site http://swagger.io) provides the most simple, yet powerful representation of your API’s. Most of the cases what you would want to do after generating a thorough set of API’s is to have a simple Java client to access these – and Swagger comes to rescue here, by providing an open source tool just to do that.

Here in this article, we would be using Swagger Codegen tool to generate our Client side code. You can simply download the Swagger Codegen zip file from this location (link to this site https://github.com/swagger-api/swagger-codegen)

Open the link and then click on the green coloured button ‘Clone or download’ and from the drop-down click on ‘Download Zip’.

How to build Swagger Codegen?

After downloading the source zip file from the site above, you would have to build this project. You could use either ANT or MAVEN to build the project, but the downloaded file is a MAVEN project. Hence there is a prerequisite that you need to have MAVEN installed and configured on the system.

Now with all the pre-requisite being handled and answered, let’s get down to business in building the Swagger Codegen project that you’ve downloaded in the last step.

  • Extract the zip file to a location which you would be referring to from a command line tool
  • Fire the following command to on a command prompt to build the project
  • mvn package

 

How to generate Client-side code using Swagger Codegen?

The above step would download all the requisite dependencies on to your local system, which is something that MAVEN handles on its own. Along with the dependencies, it will also generate the needed modules under this directory which will be used in the steps below. With the above step done, you’ll need to follow the steps below to get the client-side code generated using Swagger Codegen.

  • There are a plenty of supported languages to choose from (like Clojure, Groovy, Haskell, Java) but I will try to keep this article targeted to be used with JAVA.
  • With the choice made above, all you need to have is a YAML or a JSON input file, which would be used to represent the API using Swagger.
  • You can take any of the sample YAML/JSON files provided by Swagger themselves, or write your own YAML by hand and use the same as the input
    • You can use Swagger editor (link to this site: http://editor.swagger.io/#/) to write your own YAML / JSON input files.
    • If you decide to go by having your own YAML / JSON input file, then this Swagger specifications (link to this site: http://swagger.io/specification/) should be followed with due respect.
  • From the same location as above, fire the command below:
    • This command will work if you are using any of the sample YAML / JSON files provided by Swagger itself
    • java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate
      
              -i http://petstore.swagger.io/v2/swagger.json
      
              -l java
      
              -o samples/client/petstore/java

       

 

  • The following command will work if you are using any of your own input YAML file to generate client-side code with an assumption that the YAML file is placed under the folder structure shown in the command below.
  • java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate
    
            -i modules/swagger-codegen-cli/target/sample_api.yaml
    
            -l java
    
            -o samples/client/java
    
    

     

    Choose whichever the case as you like and it will generate a java project with the package structure as mentioned in the command above with the -o

How to use the generated client-side code?

Now that the toughest part of the task being completed, you could use the generated client side code in whichever way that you wish.

  • You could import this code as a Java project into any IDE of your choice or you could very well zip the project as a JAR and ship to it whoever wants to gain access to your API’s that are generated.
  • If you take a look into the code that has been created, you would find a package named ‘io.swagger.client.api’ and under which you’d find 3 classes. Using these you would be able to do whatever you want with the API specification that you have.
  • A sample code to say update a pet and display it’s name can be done using the following code.
package io.swagger.test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.w3c.dom.ls.LSException;

import io.swagger.client.ApiException;
import io.swagger.client.api.*;

public class test 
{
  public static void main(String[] args) throws IOException
  {
    List<String> status = new ArrayList<String>();
    status.add("sold");
    PetApi pet = new PetApi();

    try 
    {
      pet.updatePetWithForm("1", "nicky", "available");
      System.out.println(pet.getPetById((long) 1).getName());
    }
    catch (ApiException e) 
    {
      e.printStackTrace();
    }
  }
}

 

 

Categories
Mobile

How to stop Saving Media automatically to your Camera Roll

With the help of internet and social applications getting in touch with like-minded individuals, this has become extremely easy. With the help of technology advancements, individuals can avail free video calling facility which is provided by “Apple”. On the flip side, if you have friends using Android phones a number of third party applications are available where you can chat and avail video calling facility. With third party applications all the media content that was transferred between your chats are stored automatically and in due course of time it will pile up and occupy most of your phone storage and lead  different issues.

This action is enabled and it is a user’s preference that can make the difference. The article will guide you in a step by step fashion to disable this option and no more media files that come from WhatsApp or Viber will be stored automatically. This will give freedom for the users to manage their phone storage smartly and also gives an option for the user to store only important images rather than storing all the unnecessary media content.

How To Disable WhatsApp Photo & Video Saving

  • Open WhatsApp
  • Tap on the settings icon (bottom right-hand corner). This will open up all the settings screen with
  • Tap on Chat
  • You will be able to disable the option for “Save Incoming Media”.

Following the above steps will make sure that all incoming media during the chats are not saved directly.

How to Save an Image from WhatsApp chat:

  • Open WhatsApp
  • Go into your chat lists
  • Tap one of the chat from the chat list
  • Tap on the image, a popup will appear with options “Save”, “Forward”, “Share”.
  • Tap on “Save” button and image is saved into your Photos

Disable Auto Media save in Viber:

Viber is one of the popular chatting application which is available  both Android and iOS platform. The user has an option to disable auto-saving of images into Camera Roll by following these steps:

  • Open Viber App
  • Tap on “More” icon (bottom right-hand corner). User will be directed to a screen where all the settings can be configured
  • Tap on Settings
  • The user has to disable “Save to Gallery” option.

Following the above steps will make sure that media content is not automatically downloaded into your Photo App.

If you are thinking only WhatsApp and Viber are actually automatically saving media content then you are wrong. A lot of third party apps actually have this option and I would recommend one to go through the settings tab of the downloaded applications and protect your privacy

Categories
Mobile

Free Video calling feature on WhatsApp Messenger

Most of us know that WhatsApp has gained huge popularity among the  customer base and has the capability to transfer more than billion message on day to day basis. After Facebook has taken over WhatsApp, the development team has introduced a number of features to make it undefeated compared to other communication/ messaging apps. As one of the software updates version no: 2.16.17 or any other further release allows users to utilize real-time bi-directional video calling feature with the existing WhatsApp contacts.

If we closely compare, real-time bi-directional video calling feature is similar to that of Apple’s Facetime calling feature. The only difference between WhatsApp video calling and Apple’s face time is that WhatsApp video calling is available in all the operating systems. I.e. iOS, Android whereas Apple’s Facetime is only restricted to iOS devices.

Bi-directional video calling feature is far better tuned by Apple’s Facetime compared to the WhatsApp video calling feature. Ultimately, it is easy to talk to your loved ones real time irrespective of their geographical location. Another advantage for users if they are already using WhatsApp and don’t own an Apple device, then they have nothing to lose as they can utilize WhatsApp video calling feature to talk to their friends and family abroad.

How to Download WhatsApp with Video Calling Feature:

If you are already a WhatsApp user then one has to install the updated software version so that video calling feature is enabled for them to utilize. If you are new to WhatsApp then you can go into Play store or App store to download the application to utilize this feature.For you to effectively utilize video calling features, one has to satisfy one clause and which is: both the users should have an updated version of WhatsApp so that they can connect.

How to Dial WhatsApp Video Call:

  1. The user has to open the app and search for the contact from the list or user can search for a contact from the chat list or from favorite’s section/ calls history etc.
  2. Once the contact is selected you will get to see icon’s like “Chat”, “Call”, “Video Call”.
  3. Based on the selection, the user will be able to initiate a video call with the desired contact.
WhatsApp Video Call Facts:
  1. Once the call is initiated, the user has an option to switch cameras (i.e. Front, Back). Based on the selection user has a capability to showcase their surroundings. This feature is similar to that of Apple’s Facetime and you can switch your camera views with your call partner.
  2. If you only want to listen the conversion and have a noisy background you can always mute your line by tapping on “Mic” icon.
  3. You can straight away Decline an incoming video calling by tapping on “Red” hang up icon. This is handy when you are not ready to present yourself in an appropriate manner.
Categories
Mobile

Apple Support App is now available in the App Store

Support app from Apple? Yes, you have read it right. Apple has launched their much-awaited support app and currently is available only in Netherlands. Plans are being made to release it worldwide soon. Also, news is out that this support app will be included within the iOS built-in software. This app might be automatically added to your iPhone or iPad home screen as soon as you update your software to iOS 10.2 version

What to expect from the app?
  • This application is mainly built to address problems that the apple customers might encounter and provide round-the-clock support.
  • Users will get to know new product releases
  • Users can schedule appointments
  • Engage with Apple advisors and get their questions clarified via Chat
  • Resolve any problems with the new iPhones, iPads and other Apple devices
How to Download the Support App:

As this application is not available across worldwide, so we recommend to download the application from the (Link). If the application is available in your country then you will be redirected to a download page, if the application is not available in your country then users will get a prompt stating it is not available. We advise to  check this site regularly to make sure they can avail real time support.

Apple Support App Features:

Once you have successfully downloaded the application, login using Apple credentials to configure the app. With this authentication, the app will be available to all the devices associated to your account and display the information.

Once the products are listed out, users will be able to avail articles about using the device and relative iPhone features.

Chat:

Users will be able to initiate a chat with Apple representative and clarify their questions and seek advice if needed.

Schedule Call:

The user will be able to schedule a call with Apple representative to clarify their questions and also seek advice if needed.

History:

All the activities that user has initiated, i.e. Calls, chats and support requests are listed and historical data is available for your future reference.

 

Exit mobile version