|
| 1 | +=begin |
| 2 | +#Datadog API V2 Collection |
| 3 | +
|
| 4 | +#Collection of all Datadog Public endpoints. |
| 5 | +
|
| 6 | +The version of the OpenAPI document: 1.0 |
| 7 | +Contact: support@datadoghq.com |
| 8 | +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator |
| 9 | +
|
| 10 | + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 11 | + This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 12 | + Copyright 2020-Present Datadog, Inc. |
| 13 | +
|
| 14 | +=end |
| 15 | + |
| 16 | +require 'cgi' |
| 17 | + |
| 18 | +module DatadogAPIClient::V2 |
| 19 | + class StegadographyAPI |
| 20 | + attr_accessor :api_client |
| 21 | + |
| 22 | + def initialize(api_client = DatadogAPIClient::APIClient.default) |
| 23 | + @api_client = api_client |
| 24 | + end |
| 25 | + |
| 26 | + # Get widgets from an image. |
| 27 | + # |
| 28 | + # @see #get_widgets_from_image_with_http_info |
| 29 | + def get_widgets_from_image(opts = {}) |
| 30 | + data, _status_code, _headers = get_widgets_from_image_with_http_info(opts) |
| 31 | + data |
| 32 | + end |
| 33 | + |
| 34 | + # Get widgets from an image. |
| 35 | + # |
| 36 | + # Extracts embedded watermarks from an uploaded PNG image (for example, a dashboard screenshot) |
| 37 | + # and returns the cached widget state matching each watermark found. |
| 38 | + # |
| 39 | + # @param opts [Hash] the optional parameters |
| 40 | + # @option opts [File] :image A PNG image (for example, a dashboard screenshot) containing embedded widget watermarks. |
| 41 | + # @return [Array<(StegadographyWidgetsResponse, Integer, Hash)>] StegadographyWidgetsResponse data, response status code and response headers |
| 42 | + def get_widgets_from_image_with_http_info(opts = {}) |
| 43 | + unstable_enabled = @api_client.config.unstable_operations["v2.get_widgets_from_image".to_sym] |
| 44 | + if unstable_enabled |
| 45 | + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_widgets_from_image") |
| 46 | + else |
| 47 | + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_widgets_from_image")) |
| 48 | + end |
| 49 | + |
| 50 | + if @api_client.config.debugging |
| 51 | + @api_client.config.logger.debug 'Calling API: StegadographyAPI.get_widgets_from_image ...' |
| 52 | + end |
| 53 | + # resource path |
| 54 | + local_var_path = '/api/v2/stegadography/get-widgets' |
| 55 | + |
| 56 | + # query parameters |
| 57 | + query_params = opts[:query_params] || {} |
| 58 | + |
| 59 | + # header parameters |
| 60 | + header_params = opts[:header_params] || {} |
| 61 | + # HTTP header 'Accept' (if needed) |
| 62 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 63 | + # HTTP header 'Content-Type' |
| 64 | + header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) |
| 65 | + |
| 66 | + # form parameters |
| 67 | + form_params = opts[:form_params] || {} |
| 68 | + form_params['image'] = opts[:'image'] if !opts[:'image'].nil? |
| 69 | + |
| 70 | + # http body (model) |
| 71 | + post_body = opts[:debug_body] |
| 72 | + |
| 73 | + # return_type |
| 74 | + return_type = opts[:debug_return_type] || 'StegadographyWidgetsResponse' |
| 75 | + |
| 76 | + # auth_names |
| 77 | + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] |
| 78 | + |
| 79 | + new_options = opts.merge( |
| 80 | + :operation => :get_widgets_from_image, |
| 81 | + :header_params => header_params, |
| 82 | + :query_params => query_params, |
| 83 | + :form_params => form_params, |
| 84 | + :body => post_body, |
| 85 | + :auth_names => auth_names, |
| 86 | + :return_type => return_type, |
| 87 | + :api_version => "V2" |
| 88 | + ) |
| 89 | + |
| 90 | + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) |
| 91 | + if @api_client.config.debugging |
| 92 | + @api_client.config.logger.debug "API called: StegadographyAPI#get_widgets_from_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 93 | + end |
| 94 | + return data, status_code, headers |
| 95 | + end |
| 96 | + end |
| 97 | +end |
0 commit comments