All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.logmein.gotowebinar.api.WebhooksApi Maven / Gradle / Ivy

There is a newer version: 2.9.0
Show newest version
/*
 * © 2017 LogMeIn, Inc. All Rights Reserved.
 * All rights reserved.
 * 
 * This software is distributed under the terms and conditions of the
 * LogMeIn SDK License Agreement. Please see file LICENSE for details.
 * 
 * Auto-generated file.
 */


package com.logmein.gotowebinar.api;

import com.logmein.gotowebinar.api.common.ApiException;
import com.logmein.gotowebinar.api.common.ApiInvoker;
import com.logmein.gotowebinar.api.common.JsonUtil;
import com.logmein.gotowebinar.api.model.CreateUserSubscriptionRequest;
import com.logmein.gotowebinar.api.model.CreateWebhookRequest;
import com.logmein.gotowebinar.api.model.SecretKeyRequest;
import com.logmein.gotowebinar.api.model.SecretKeyResponse;
import com.logmein.gotowebinar.api.model.UpdateUserSubscriptionsRequest;
import com.logmein.gotowebinar.api.model.UpdateWebhooksRequest;
import com.logmein.gotowebinar.api.model.UserSubscription;
import com.logmein.gotowebinar.api.model.UserSubscriptionResponse;
import com.logmein.gotowebinar.api.model.Webhook;
import com.logmein.gotowebinar.api.model.WebhooksResponse;
import com.sun.jersey.multipart.FormDataMultiPart;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WebhooksApi {

    private String basePath = "https://api.getgo.com/G2W/rest/v2";
    private ApiInvoker apiInvoker = ApiInvoker.getInstance();

    /**
      * Initializes a new instance of the WebhooksApi class using the
      * default endpoint base url for the services being accessed.
      */
    public WebhooksApi() {
    }
    
    /**
      * Initializes a new instance of the WebhooksApi class using an endpoint base
      * url other than the default. Use this constructor only if you should need
      * to override the default endpoint base url.
      * @param basePath The endpoint base url for the services being accessed.
      */
    public WebhooksApi(String basePath) {
        this.basePath = basePath;
    }

    public ApiInvoker getInvoker() {
        return apiInvoker;
    }
  
    public String getBasePath() {
        return basePath;
    }

    /**
     * Creates a new secret key
     * This creates a new secret key per application. It takes an optional validFrom value, a date time in ISO8601 format, e.g. 2019-07-01T22:00:00Z. The secret key will be activated at the given date. If validFrom is not passed, the secret key will be activated immediately. The secret key is used to generate a signature for events published to the callback url.
     * @param authorization Access token
     * @param body The secret key object to create
     * @return SecretKeyResponse
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public SecretKeyResponse createSecretKey(String authorization, SecretKeyRequest body) throws ApiException {

        Object postBody = body;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(body == null) {
            throw new ApiException("Required parameter body is null.");
        }

        // create path and map variables
        String path = "/webhooks/secretkey"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
        if(response != null){
            return (SecretKeyResponse) ApiInvoker.deserialize(response, "", SecretKeyResponse.class);
        }
        return null;
    }

    /**
     * Creates new user subscriptions
     * A user subscriptions will be created for the provided webhook. Callback url can be provided for user subscription. The callback url will be validated by making a GET request. It should return 200 OK.
     * @param authorization Access token
     * @param body User subscriptions to create
     * @return UserSubscriptionResponse
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public UserSubscriptionResponse createUserSubscriptions(String authorization, List body) throws ApiException {

        Object postBody = body;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(body == null) {
            throw new ApiException("Required parameter body is null.");
        }

        // create path and map variables
        String path = "/userSubscriptions"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
        if(response != null){
            return (UserSubscriptionResponse) ApiInvoker.deserialize(response, "", UserSubscriptionResponse.class);
        }
        return null;
    }

    /**
     * Creates new webhooks
     * A new webhook will be created with the provided callback url. Callback url should be a https url. Callback url will be validated by making a GET request. It should return 200 OK.
     * @param authorization Access token
     * @param body Webhooks object to create
     * @return WebhooksResponse
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public WebhooksResponse createWebhooks(String authorization, List body) throws ApiException {

        Object postBody = body;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(body == null) {
            throw new ApiException("Required parameter body is null.");
        }

        // create path and map variables
        String path = "/webhooks"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
        if(response != null){
            return (WebhooksResponse) ApiInvoker.deserialize(response, "", WebhooksResponse.class);
        }
        return null;
    }

    /**
     * Deletes user subscriptions
     * Deletes user subscriptions by list of userSubscriptionKeys
     * @param authorization Access token
     * @param body List of userSubscriptionKeys to delete
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public void deleteUserSubscriptions(String authorization, List body) throws ApiException {

        Object postBody = body;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(body == null) {
            throw new ApiException("Required parameter body is null.");
        }

        // create path and map variables
        String path = "/userSubscriptions"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
    }

    /**
     * Deletes webhooks
     * Deletes webhooks by list of webhookKeys
     * @param authorization Access token
     * @param body List of webhookKeys to delete
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public void deleteWebhooks(String authorization, List body) throws ApiException {

        Object postBody = body;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(body == null) {
            throw new ApiException("Required parameter body is null.");
        }

        // create path and map variables
        String path = "/webhooks"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
    }

    /**
     * Get user subscription
     * Get a user subscription by userSubscriptionKey for the requesting user.
     * @param authorization Access token
     * @param userSubscriptionsKey The unique identifier for a user subscription.
     * @return UserSubscription
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public UserSubscription getUserSubscription(String authorization, String userSubscriptionsKey) throws ApiException {

        Object postBody = null;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(userSubscriptionsKey == null) {
            throw new ApiException("Required parameter userSubscriptionsKey is null.");
        }

        // create path and map variables
        String path = "/userSubscriptions/{userSubscriptionsKey}"
                .replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "userSubscriptionsKey" + "\\}", apiInvoker.escapeString(userSubscriptionsKey.toString()));

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
        if(response != null){
            return (UserSubscription) ApiInvoker.deserialize(response, "", UserSubscription.class);
        }
        return null;
    }

    /**
     * Get user subscriptions
     * Get the list of user subscriptions by product for the requesting user. Product must be provided.
     * @param authorization Access token
     * @param product Supported products
     * @return UserSubscriptionResponse
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public UserSubscriptionResponse getUserSubscriptions(String authorization, String product) throws ApiException {

        Object postBody = null;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(product == null) {
            throw new ApiException("Required parameter product is null.");
        }

        // create path and map variables
        String path = "/userSubscriptions"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        String productString = JsonUtil.Stringify(product);
        if(!"null".equals(productString)){
            queryParams.put("product", productString);
        }

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
        if(response != null){
            return (UserSubscriptionResponse) ApiInvoker.deserialize(response, "", UserSubscriptionResponse.class);
        }
        return null;
    }

    /**
     * Get webhook
     * Get a webhook by webhookKey for the requesting user.
     * @param authorization Access token
     * @param webhookKey The unique identifier for a webhook.
     * @return Webhook
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public Webhook getWebhook(String authorization, String webhookKey) throws ApiException {

        Object postBody = null;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(webhookKey == null) {
            throw new ApiException("Required parameter webhookKey is null.");
        }

        // create path and map variables
        String path = "/webhooks/{webhookKey}"
                .replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "webhookKey" + "\\}", apiInvoker.escapeString(webhookKey.toString()));

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
        if(response != null){
            return (Webhook) ApiInvoker.deserialize(response, "", Webhook.class);
        }
        return null;
    }

    /**
     * Get webhooks
     * Get the list of webhooks by product for the requesting user. Product must be provided.
     * @param authorization Access token
     * @param product Supported products
     * @return WebhooksResponse
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public WebhooksResponse getWebhooks(String authorization, String product) throws ApiException {

        Object postBody = null;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(product == null) {
            throw new ApiException("Required parameter product is null.");
        }

        // create path and map variables
        String path = "/webhooks"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        String productString = JsonUtil.Stringify(product);
        if(!"null".equals(productString)){
            queryParams.put("product", productString);
        }

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
        if(response != null){
            return (WebhooksResponse) ApiInvoker.deserialize(response, "", WebhooksResponse.class);
        }
        return null;
    }

    /**
     * Updates user subscriptions
     * Callback url and state of user subscriptions can be updated using this API. The callback url will be validated by making a GET request. It should return 200 OK.
     * @param authorization Access token
     * @param body User subscriptions to update
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public void updateUserSubscriptions(String authorization, List body) throws ApiException {

        Object postBody = body;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(body == null) {
            throw new ApiException("Required parameter body is null.");
        }

        // create path and map variables
        String path = "/userSubscriptions"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType);
    }

    /**
     * Updates webhooks
     * Callback url and state of webhooks can be updated using this API. Callback url should be a https url. Callback url will be validated by making a GET request. It should return 200 OK.
     * @param authorization Access token
     * @param body Webhooks object to update
     * @throws ApiException If the response status code is not Successful 2xx, or an error has occurred during parameter serialization or response deserialization
     */
    public void updateWebhooks(String authorization, List body) throws ApiException {

        Object postBody = body;

        if(authorization == null) {
            throw new ApiException("Required parameter authorization is null.");
        }

        if(body == null) {
            throw new ApiException("Required parameter body is null.");
        }

        // create path and map variables
        String path = "/webhooks"
                .replaceAll("\\{format\\}", "json");

        // query params
        Map queryParams = new HashMap();
        Map headerParams = new HashMap();
        Map formParams = new HashMap();

        headerParams.put("Authorization", authorization);

        String[] contentTypes = {
            "application/json"
        };
        String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

        if(contentType.startsWith("multipart/form-data")) {
            boolean hasFields = false;
            FormDataMultiPart mp = new FormDataMultiPart();

            if(hasFields)
                postBody = mp;
        }
        else {
        }

        apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType);
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy