Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions examples/DocumentDetectFieldsExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;

using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

namespace Dropbox.SignSandbox;

public class DocumentDetectFieldsExample
{
public static void Run()
{
var config = new Configuration();
config.Username = "YOUR_API_KEY";
// config.AccessToken = "YOUR_ACCESS_TOKEN";

var documentFieldDetectionRequest = new DocumentFieldDetectionRequest(
detectionMode: "annotations",
file: new FileStream(
path: "./example_document.pdf",
mode: FileMode.Open
),
pageRange: "all"
);

try
{
var response = new DocumentApi(config).DocumentDetectFields(
documentFieldDetectionRequest: documentFieldDetectionRequest
);

Console.WriteLine(response);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling DocumentApi#DocumentDetectFields: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
}
}
46 changes: 46 additions & 0 deletions examples/DocumentDetectFieldsExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.dropbox.sign_sandbox;

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.JSON;
import com.dropbox.sign.model.*;

import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class DocumentDetectFieldsExample
{
public static void main(String[] args)
{
var config = Configuration.getDefaultApiClient();
((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY");
// ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN");

var documentFieldDetectionRequest = new DocumentFieldDetectionRequest();
documentFieldDetectionRequest.detectionMode("annotations");
documentFieldDetectionRequest._file(new File("./example_document.pdf"));
documentFieldDetectionRequest.pageRange("all");

try
{
var response = new DocumentApi(config).documentDetectFields(
documentFieldDetectionRequest
);

System.out.println(response);
} catch (ApiException e) {
System.err.println("Exception when calling DocumentApi#documentDetectFields");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
27 changes: 27 additions & 0 deletions examples/DocumentDetectFieldsExample.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Dropbox\SignSandbox;

require_once __DIR__ . '/../vendor/autoload.php';

use SplFileObject;
use Dropbox;

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();
$config->setUsername("YOUR_API_KEY");
// $config->setAccessToken("YOUR_ACCESS_TOKEN");

$document_field_detection_request = (new Dropbox\Sign\Model\DocumentFieldDetectionRequest())
->setDetectionMode("annotations")
->setFile(new SplFileObject("./example_document.pdf"))
->setPageRange("all");

try {
$response = (new Dropbox\Sign\Api\DocumentApi(config: $config))->documentDetectFields(
document_field_detection_request: $document_field_detection_request,
);

print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
echo "Exception when calling DocumentApi#documentDetectFields: {$e->getMessage()}";
}
26 changes: 26 additions & 0 deletions examples/DocumentDetectFieldsExample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import json
from datetime import date, datetime
from pprint import pprint

from dropbox_sign import ApiClient, ApiException, Configuration, api, models

configuration = Configuration(
username="YOUR_API_KEY",
# access_token="YOUR_ACCESS_TOKEN",
)

with ApiClient(configuration) as api_client:
document_field_detection_request = models.DocumentFieldDetectionRequest(
detection_mode="annotations",
file=open("./example_document.pdf", "rb").read(),
page_range="all",
)

try:
response = api.DocumentApi(api_client).document_detect_fields(
document_field_detection_request=document_field_detection_request,
)

pprint(response)
except ApiException as e:
print("Exception when calling DocumentApi#document_detect_fields: %s\n" % e)
22 changes: 22 additions & 0 deletions examples/DocumentDetectFieldsExample.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require "json"
require "dropbox-sign"

Dropbox::Sign.configure do |config|
config.username = "YOUR_API_KEY"
# config.access_token = "YOUR_ACCESS_TOKEN"
end

document_field_detection_request = Dropbox::Sign::DocumentFieldDetectionRequest.new
document_field_detection_request.detection_mode = "annotations"
document_field_detection_request.file = File.new("./example_document.pdf", "r")
document_field_detection_request.page_range = "all"

begin
response = Dropbox::Sign::DocumentApi.new.document_detect_fields(
document_field_detection_request,
)

p response
rescue Dropbox::Sign::ApiError => e
puts "Exception when calling DocumentApi#document_detect_fields: #{e}"
end
5 changes: 5 additions & 0 deletions examples/DocumentDetectFieldsExample.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
curl -X POST 'https://api.hellosign.com/v3/document/detect_fields' \
-u 'YOUR_API_KEY:' \
-F 'file=@example_document.pdf' \
-F 'detection_mode=annotations' \
-F 'page_range=all'
22 changes: 22 additions & 0 deletions examples/DocumentDetectFieldsExample.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as fs from 'fs';
import api from "@dropbox/sign"
import models from "@dropbox/sign"

const apiCaller = new api.DocumentApi();
apiCaller.username = "YOUR_API_KEY";
// apiCaller.accessToken = "YOUR_ACCESS_TOKEN";

const documentFieldDetectionRequest: models.DocumentFieldDetectionRequest = {
detectionMode: "annotations",
file: fs.createReadStream("./example_document.pdf"),
pageRange: "all",
};

apiCaller.documentDetectFields(
documentFieldDetectionRequest,
).then(response => {
console.log(response.body);
}).catch(error => {
console.log("Exception when calling DocumentApi#documentDetectFields:");
console.log(error.body);
});
Loading
Loading