diff --git a/.fern/metadata.json b/.fern/metadata.json
new file mode 100644
index 00000000..757181e8
--- /dev/null
+++ b/.fern/metadata.json
@@ -0,0 +1,12 @@
+{
+ "cliVersion": "3.0.2",
+ "generatorName": "fernapi/fern-java-sdk",
+ "generatorVersion": "3.21.0",
+ "generatorConfig": {
+ "enable-inline-types": true,
+ "client-class-name": "Intercom",
+ "inline-path-parameters": true,
+ "enable-forward-compatible-enums": true,
+ "enable-wire-tests": false
+ }
+}
\ No newline at end of file
diff --git a/.fernignore b/.fernignore
new file mode 100644
index 00000000..88a7de55
--- /dev/null
+++ b/.fernignore
@@ -0,0 +1,6 @@
+# Specify files that shouldn't be modified by Fern
+
+src/test/java/com/intercom/api/integration
+src/test/java/com/intercom/api/utils
+
+.github/workflows/ci.yml
diff --git a/.github/workflows-disabled/ci.yml b/.github/workflows-disabled/ci.yml
new file mode 100644
index 00000000..923e5103
--- /dev/null
+++ b/.github/workflows-disabled/ci.yml
@@ -0,0 +1,67 @@
+name: ci
+
+on: [push]
+
+jobs:
+ compile:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+
+ - name: Set up Java
+ id: setup-jre
+ uses: actions/setup-java@v1
+ with:
+ java-version: "11"
+ architecture: x64
+
+ - name: Compile
+ run: ./gradlew compileJava
+
+ test:
+ needs: [ compile ]
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+
+ - name: Set up Java
+ id: setup-jre
+ uses: actions/setup-java@v1
+ with:
+ java-version: "11"
+ architecture: x64
+
+ - name: Test
+ run: ./gradlew test
+ env:
+ INTERCOM_API_KEY: ${{ secrets.INTERCOM_API_KEY }}
+
+ publish:
+ needs: [ compile ]
+ if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+
+ - name: Set up Java
+ id: setup-jre
+ uses: actions/setup-java@v1
+ with:
+ java-version: "11"
+ architecture: x64
+
+ - name: Publish to maven
+ run: |
+ ./gradlew sonatypeCentralUpload -x test
+ env:
+ MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
+ MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/"
+ MAVEN_SIGNATURE_KID: ${{ secrets.MAVEN_SIGNATURE_KID }}
+ MAVEN_SIGNATURE_SECRET_KEY: ${{ secrets.MAVEN_SIGNATURE_SECRET_KEY }}
+ MAVEN_SIGNATURE_PASSWORD: ${{ secrets.MAVEN_SIGNATURE_PASSWORD }}
diff --git a/.gitignore b/.gitignore
index edcdd547..d4199abc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,24 @@
-*/**/SpikeMain.java
-.gradle
*.class
-out/*
+.project
+.gradle
+?
+.classpath
+.checkstyle
+.settings
+.node
+build
+
+# IntelliJ
*.iml
*.ipr
*.iws
-build
-*/build/*
-*/build/**/*.jar
-*.war
-*.ear
-hs_err_pid*
-.idea
+.idea/
+out/
+
+# Eclipse/IntelliJ APT
+generated_src/
+generated_testSrc/
+generated/
+
+bin
+build
\ No newline at end of file
diff --git a/.publish/prepare.sh b/.publish/prepare.sh
new file mode 100755
index 00000000..df3948e3
--- /dev/null
+++ b/.publish/prepare.sh
@@ -0,0 +1,8 @@
+# Write key ring file
+echo "$MAVEN_SIGNATURE_SECRET_KEY" > armored_key.asc
+gpg -o publish_key.gpg --dearmor armored_key.asc
+
+# Generate gradle.properties file
+echo "signing.keyId=$MAVEN_SIGNATURE_KID" > gradle.properties
+echo "signing.secretKeyRingFile=publish_key.gpg" >> gradle.properties
+echo "signing.password=$MAVEN_SIGNATURE_PASSWORD" >> gradle.properties
diff --git a/CHANGES.md b/CHANGES.md
deleted file mode 100644
index db5e1592..00000000
--- a/CHANGES.md
+++ /dev/null
@@ -1,56 +0,0 @@
-### Changes
-
-#### 1.0.3
-
-encode social profile urls for user objects
-
-#### 1.0.2
-
-- fix NPE when errors have no data [30](https://github.com/intercom/intercom-java/pull/30)
-
-#### 1.0.1
-
- - send custom company attributes on update
-
- - fix NPE when company has no plan on update
-
- - invalidate setSessionCount on Company [27](https://github.com/intercom/intercom-java/issues/27)
-
-#### 1.0.0
-
- - removed tag methods requiring collections
-
- - handle non-json error entities from server
-
-#### 0.1.0
-
- - support untag of users and companies
-
- - renamed of current page and page methods on collections (breaking)
-
-#### 0.0.5
-
-- fix bulk user tagging when using fully populated users [13](https://github.com/intercom/intercom-java/issues/13)
-- add client side validation of events [14](https://github.com/intercom/intercom-java/issues/14)
-- fix npe when updating users [15](https://github.com/intercom/intercom-java/issues/15)
-
-
-#### 0.0.4
-
-- send false boolean values for user updates [8](https://github.com/intercom/intercom-java/issues/8)
-
-#### 0.0.3
-
-- only send allowed fields when adding a company to a user [7](https://github.com/intercom/intercom-java/issues/7)
-
-#### 0.0.2
-
- - add toString methods on some classes
-
-#### 0.0.1
-
- - fix bintray publication task (was sending empty jars)
-
-#### 0.0.0
-
- - initial client
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 305509fc..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright 2014 Intercom, Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
\ No newline at end of file
diff --git a/README.md b/README.md
index ac69e137..8ba7df9c 100644
--- a/README.md
+++ b/README.md
@@ -1,542 +1,318 @@
-[](https://circleci.com/gh/intercom/intercom-java)
+# Intercom Java Library
-# intercom-java
+[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fintercom%2Fintercom-java)
+[](https://central.sonatype.com/artifact/io.intercom/intercom-java)
-Java bindings for the [Intercom API](https://api.intercom.io/docs)
+The Intercom Java library provides convenient access to the Intercom APIs from Java.
- - [Installation](#installation)
- - [Resources](#resources)
- - [Authorization](#authorization)
- - [Usage](#usage)
- - [Idioms](#idioms)
- - [Configuration](#configuration)
+## Table of Contents
+- [Installation](#installation)
+- [Reference](#reference)
+- [Usage](#usage)
+- [Environments](#environments)
+- [Base Url](#base-url)
+- [Exception Handling](#exception-handling)
+- [Advanced](#advanced)
+ - [Custom Client](#custom-client)
+ - [Retries](#retries)
+ - [Timeouts](#timeouts)
+ - [Custom Headers](#custom-headers)
+ - [Access Raw Response Data](#access-raw-response-data)
+- [Contributing](#contributing)
-## Add a dependency
+## Installation
-[  ](https://bintray.com/intercom/intercom-maven/intercom-java/_latestVersion)
+### Gradle
-The distribution is hosted on [bintray](https://bintray.com/intercom/intercom-maven/intercom-java/view).
-To use the client, you can add the jcenter repository to your dependencies.
+Add the dependency in your `build.gradle` file:
-### maven
+```groovy
+dependencies {
+ implementation 'io.intercom:intercom-java'
+}
+```
-Add jcenter to your repositories in `pom.xml` or `settings.xml`:
+### Maven
+
+Add the dependency in your `pom.xml` file:
-```xml
-
-
- jcenter
- http://jcenter.bintray.com
-
-
-```
-
-and add the project declaration to your `pom.xml`:
-
```xml
io.intercom
intercom-java
- 1.0.3
+ 4.0.4
```
-### gradle
+## Reference
-Add jcenter to your `repositories` block:
+A full reference for this library is available [here](https://github.com/intercom/intercom-java/blob/HEAD/./reference.md).
-```groovy
-repositories {
- jcenter()
-}
-```
+## Usage
-and add the project to the `dependencies` block in your `build.gradle`:
+Instantiate and use the client with the following:
-```groovy
-dependencies {
- compile 'io.intercom:intercom-java:1.0.3'
-}
+```java
+package com.example.usage;
+
+import com.intercom.api.Intercom;
+import com.intercom.api.resources.aicontent.requests.CreateContentImportSourceRequest;
+
+public class Example {
+ public static void main(String[] args) {
+ Intercom client = Intercom
+ .builder()
+ .token("")
+ .build();
+
+ client.aiContent().createContentImportSource(
+ CreateContentImportSourceRequest
+ .builder()
+ .url("https://www.example.com")
+ .build()
+ );
+ }
+}
```
+## Environments
-## Resources
-
-Resources this API supports:
-
-- [Users](#users)
-- [Companies](#companies)
-- [Admins](#admins)
-- [Events](#events)
-- [Tags](#tags)
-- [Segments](#segments)
-- [Notes](#notes)
-- [Conversations](#conversations)
-- [Messages](#messages)
-- [Counts](#counts)
-- [Webhooks](#webhooks)
+This SDK allows you to configure different environments for API requests.
+```java
+import com.intercom.api.Intercom;
+import com.intercom.api.core.Environment;
+Intercom client = Intercom
+ .builder()
+ .environment(Environment.USProduction)
+ .build();
+```
-## Authorization
+## Base Url
-You can set the app's id and api key via the `Intercom` object -
+You can set a custom base URL when constructing the client.
```java
-Intercom.setAppID("pi3243fa");
-Intercom.setApiKey("da39a3ee5e6b4b0d3255bfef95601890afd80709");
-```
+import com.intercom.api.Intercom;
+Intercom client = Intercom
+ .builder()
+ .url("https://example.com")
+ .build();
+```
-## Usage
+## Exception Handling
-### Users
+When the API returns a non-success status code (4xx or 5xx response), an API exception will be thrown.
```java
-// Create a user
-User user = new User()
- .setEmail("malcolm@serenity.io")
- .setUserId("1")
- .addCustomAttribute(CustomAttribute.newStringAttribute("role", "sergeant"))
- .addCustomAttribute(CustomAttribute.newBooleanAttribute("browncoat", true));
-User created = User.create(user);
-
-// Find user by id
-user = User.find("541a144b201ebf2ec5000001");
-
-// Find user by email
-Map params = Maps.newHashMap();
-params.put("email", "malcolm@serenity.io");
-user = User.find(params);
-
-// Find user by user_id
-params = Maps.newHashMap();
-params.put("user_id", "1");
-user = User.find(params);
-
-// Update custom_attributes for a user
-user.addCustomAttribute(CustomAttribute.newStringAttribute("role", "captain"));
-User.update(user);
-
-// Iterate over all users
-UserCollection users = User.list();
-while(users.hasNext()) {
- System.out.println(users.next().getUserId());
+import com.intercom.api.core.IntercomApiApiException;
+
+try{
+ client.aiContent().createContentImportSource(...);
+} catch (IntercomApiApiException e){
+ // Do something with the API exception...
}
```
-### Companies
+## Advanced
-```java
-// Create a company
-Company company = new Company();
- company.setName("Blue Sun");
- company.setCompanyID("1");
- company.setPlan(new Company.Plan("premium"));
- company.addCustomAttribute(CustomAttribute.newIntegerAttribute("foddstuff-items", 246));
- company.addCustomAttribute(CustomAttribute.newStringAttribute("bestseller", "fruity oaty bar"));
-Company.create(company);
-
-// Find a company by company_id
-map = Maps.newHashMap();
-map.put("company_id", "1");
-Company company = Company.find(map);
-
-// Find a company by name
-map = Maps.newHashMap();
-map.put("name", "Blue Sun");
-Company company = Company.find(map);
-
-// Find a company by id
-Company company = Company.find("541a144b201ebf2ec5000001");
-
-// Update a company
-company.setName("Blue Sun Corporation");
-Company.update(company);
-
-// Iterate over all companies
-CompanyCollection companies = Company.list();
-while(companies.hasNext()) {
- System.out.println(companies.next().getName());
-}
+### Custom Client
-// Get a list of users in a company
-map = Maps.newHashMap();
-map.put("company_id", "6");
-UserCollection users = Company.listUsers(map);
+This SDK is built to work with any instance of `OkHttpClient`. By default, if no client is provided, the SDK will construct one.
+However, you can pass your own client like so:
-// Add a user to one or more companies
-User user = User.find("541a144b201ebf2ec5000001");
-user.addCompany(company);
-User.update(user);
-```
+```java
+import com.intercom.api.Intercom;
+import okhttp3.OkHttpClient;
-### Admins
+OkHttpClient customClient = ...;
-```java
-// Iterate over all admins
-AdminCollection admins = Admin.list();
-while(admins.hasNext()) {
- System.out.println(admins.next().getName());
-}
+Intercom client = Intercom
+ .builder()
+ .httpClient(customClient)
+ .build();
```
+### Retries
-### Events
+The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
+as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
+retry limit (default: 2). Before defaulting to exponential backoff, the SDK will first attempt to respect
+the `Retry-After` header (as either in seconds or as an HTTP date), and then the `X-RateLimit-Reset` header
+(as a Unix timestamp in epoch seconds); failing both of those, it will fall back to exponential backoff.
-```java
-Event event = new Event().setEventName("bought-hat")
- .setUserID("1")
- .putMetadata("invitee_email", "jayne@serenity.io")
- .putMetadata("found_date", System.currentTimeMillis())
- .putMetadata("new_signup", true);
-Event.create(event);
-```
+A request is deemed retryable when any of the following HTTP status codes is returned:
+- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
+- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
+- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
-### Tags
+Use the `maxRetries` client option to configure this behavior.
```java
-// create a tag
-Tag tag = new Tag().setName("alliance");
-tag = Tag.create(tag);
-
-// update a tag
-tag.setName("independent");
-tag = Tag.update(tag);
-
-// tag and untag users
-User one = new User().setEmail("river@serenity.io");
-User two = new User().setEmail("simon@serenity.io").untag();
-User.create(one);
-User.create(two);
-Tag.tag(tag, one, two);
-
-// iterate over all tags
-final TagCollection tags = Tag.list();
-while (tags.hasNext()) {
- System.out.println(tags.next().getId());
-}
+import com.intercom.api.Intercom;
-// tag and untag companies
-Company c1 = new Company().setCompanyID("1");
-Company c2 = new Company().setCompanyID("2").untag();
-Company.create(c1);
-Company.create(c2);
-Tag.tag(tag, c1, c2);
-
-// delete a tag
-Tag.delete(tag);
+Intercom client = Intercom
+ .builder()
+ .maxRetries(1)
+ .build();
```
-### Segments
-
-```java
-// Find a segment
-Segment segment = Segment.find("1");
-
-// Update a segment
-segment.setName("new name");
-Segment.update(segment);
-
-// Iterate over all segments
-SegmentCollection segments = Segment.list();
-while(segments.hasNext()) {
- System.out.println(segments.next().getId());
-}
-```
+### Timeouts
-### Notes
+The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
```java
-// create a user note
-User user = new User().setId("5310d8e8598c9a0b24000005");
-Author author = new Author().setId("1");
-Note note = new Note()
- .setUser(user)
- .setAuthor(author)
- .setBody("The note");
-Note.create(note);
-
-// Find a note by id
-note = Note.find("1");
-
-// Iterate over all notes for a user via their user_id
-Map params = Maps.newHashMap();
-params.put("user_id", "1");
-NoteCollection notes = Note.list(params);
-while(notes.hasNext()) {
- System.out.println(notes.next().getBody());
-}
-
-// Iterate over all notes for a user via their email address
-params = Maps.newHashMap();
-params.put("email", "malcolm@serenity.io");
-notes = Note.list(params);
-while(notes.hasNext()) {
- System.out.println(notes.next().getBody());
-}
+import com.intercom.api.Intercom;
+import com.intercom.api.core.RequestOptions;
+
+// Client level
+Intercom client = Intercom
+ .builder()
+ .timeout(10)
+ .build();
+
+// Request level
+client.aiContent().createContentImportSource(
+ ...,
+ RequestOptions
+ .builder()
+ .timeout(10)
+ .build()
+);
```
-### Conversations
+### Custom Headers
-```java
-// send a message to a user
-User user = new User().setId("5310d8e8598c9a0b24000005");
-Admin admin = new Admin().setId("1");
-AdminMessage adminMessage = new AdminMessage()
- .setAdmin(admin)
- .setUser(user)
- .setSubject("This Land")
- .setBody("Har har har! Mine is an evil laugh!")
- .setMessageType("email")
- .setTemplate("plain");
-Conversation.create(adminMessage);
-
-// send a message from a user
-UserMessage userMessage = new UserMessage()
- .setBody("Hey! Is there, is there a reward?")
- .setUser(user);
-Conversation.create(userMessage);
-
-// find admin conversations
-Map params = Maps.newHashMap();
-params.put("type", "admin");
-params.put("admin_id", "1");
-ConversationCollection adminConversations = Conversation.list(params);
-while (adminConversations.hasNext()) {
- Conversation conversation = adminConversations.next();
-}
-
-// find user conversations
-params = Maps.newHashMap();
-params.put("type", "user");
-params.put("user_id", "1");
-ConversationCollection userConversations = Conversation.list(params);
-while (userConversations.hasNext()) {
- Conversation conversation = userConversations.next();
-}
-
-// find a conversation by id
-final Conversation conversation = Conversation.find("66");
-ConversationMessage conversationMessage = conversation.getConversationMessage();
-ConversationPartCollection parts = conversation.getConversationPartCollection();
-List partList = parts.getPageItems();
-for (ConversationPart part : partList) {
- String partType = part.getPartType();
- Author author = part.getAuthor();
- String body = part.getBody();
-}
-ConversationPart part = conversation.getMostRecentConversationPart();
-Admin assignee = conversation.getAssignee();
-User user = conversation.getUser();
-
-// admin reply
-Admin admin = new Admin().setId("1");
-AdminReply adminReply = new AdminReply(admin);
-adminReply.setBody("These apples are healthsome");
-Conversation.reply("66", adminReply);
-
-// user reply
-User user1 = new User().setId("5310d8e8598c9a0b24000005");
-UserReply userReply = new UserReply(user1);
-userReply.setBody("Mighty fine shindig");
-System.out.println(MapperSupport.objectMapper().writeValueAsString(userReply));
-Conversation.reply("66", userReply);
-```
-
-### Webhooks
+The SDK allows you to add custom headers to requests. You can configure headers at the client level or at the request level.
```java
-// create a subscription
-Subscription subscription = new Subscription();
-subscription.setUrl(new URI("https://example.org/webhooks/1"));
-subscription.addTopic(Subscription.Topic.USER_CREATED);
-subscription.addTopic(Subscription.Topic.USER_TAG_CREATED);
-subscription.addTopic(Subscription.Topic.COMPANY);
-subscription.setAppID("pi3243fa");
-Subscription.create(subscription);
-
-// find a subscription
-subscription = Subscription.find("nsub_60ca7690-4020-11e4-b789-4961958e51bd");
-
-// list subscriptions
-SubscriptionCollection list = Subscription.list();
-while(list.hasNext()) {
- Subscription sub = list.next();
- String appID = sub.getAppID();
- String serviceType = sub.getServiceType();
- List topics = sub.getTopics();
- String hubSecret = sub.getHubSecret();
-}
+import com.intercom.api.Intercom;
+import com.intercom.api.core.RequestOptions;
+
+// Client level
+Intercom client = Intercom
+ .builder()
+ .addHeader("X-Custom-Header", "custom-value")
+ .addHeader("X-Request-Id", "abc-123")
+ .build();
+;
+
+// Request level
+client.aiContent().createContentImportSource(
+ ...,
+ RequestOptions
+ .builder()
+ .addHeader("X-Request-Header", "request-value")
+ .build()
+);
+```
-// notification sent feed
-NotificationCollection sent = Subscription.sentFeed(subscription.getId());
-while(sent.hasNext()) {
- Notification notification = sent.next();
- String id = notification.getId();
- String topic = notification.getTopic();
- NotificationData data = notification.getData();
- String type = data.getType();
- // raw map representation of the payload
- Map item = data.getItem();
-}
+### Access Raw Response Data
-// notification error feed
-NotificationErrorCollection errors = Subscription.errorFeed(subscription.getId());
-while (errors.hasNext()) {
- NotificationError notificationError = errors.next();
- RequestResponseCapture capture = notificationError.getCapture();
- URI requestURI = capture.getRequestURI();
- String requestMethod = capture.getRequestMethod();
- Map requestHeaders = capture.getRequestHeaders();
- String requestEntity = capture.getRequestEntity();
- int statusCode = capture.getResponseStatusCode();
- Map responseHeaders = capture.getResponseHeaders();
- String responseEntity = capture.getResponseEntity();
-}
+The SDK provides access to raw response data, including headers, through the `withRawResponse()` method.
+The `withRawResponse()` method returns a raw client that wraps all responses with `body()` and `headers()` methods.
+(A normal client's `response` is identical to a raw client's `response.body()`.)
-// consume a webhook notification
-InputStream jsonStream = ...;
-final Notification notification = Notification.readJSON(jsonStream);
+```java
+CreateContentImportSourceHttpResponse response = client.aiContent().withRawResponse().createContentImportSource(...);
-String jsonString = ...;
-final Notification notification = Notification.readJSON(jsonString);
+System.out.println(response.body());
+System.out.println(response.headers().get("X-My-Header"));
```
-### Counts
+## Contributing
-```java
-// app totals
-Counts.Totals totals = Counts.appTotals();
-System.out.println("companies: " + totals.getCompany().getValue());
-System.out.println("segments: :" + totals.getSegment().getValue());
-System.out.println("tags: :" + totals.getTag().getValue());
-System.out.println("users: :" + totals.getUser().getValue());
-
-// conversation totals
-Counts.Conversation conversationTotals = Counts.conversationTotals();
-System.out.println("assigned: " + conversationTotals.getAssigned());
-System.out.println("closed: :" + conversationTotals.getClosed());
-System.out.println("open: :" + conversationTotals.getOpen());
-System.out.println("unassigned: :" + conversationTotals.getUnassigned());
-
-// admin open/close counts
-Counts.Conversation adminCounts = Counts.conversationAdmins();
-List admins = adminCounts.getAdmins();
-for (Admin admin : admins) {
- System.out.println(admin.getName() + ": " + admin.getClosed() + ", " + admin.getOpen());
-}
+While we value open-source contributions to this SDK, this library is generated programmatically.
+Additions made directly to this library would have to be moved over to our generation code,
+otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
+a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
+an issue first to discuss with us!
-// tag user counts
-System.out.println("tag user counts: ");
-List tags = Counts.userTags();
-for (Counts.CountItem tag : tags) {
- System.out.println(tag.getName()+": " +tag.getValue());
-}
+On the other hand, contributions to the README are always very welcome!
-// segment user counts
-List segments = Counts.userSegments();
-for (Counts.CountItem segment : segments) {
- System.out.println(segment.getName()+": " +segment.getValue());
-}
+## For Maintainers
-// company user counts
-List companyUsers = Counts.companyUsers();
-for (Counts.CountItem company : companyUsers) {
- System.out.println(company.getName()+": " +company.getValue());
-}
+### Regenerating the SDK
-// company tag counts
-List companyTags = Counts.companyTags();
-for (Counts.CountItem tag : companyTags) {
- System.out.println(tag.getName()+": " +tag.getValue());
-}
-```
+This SDK is generated using [Fern](https://buildwithfern.com). To regenerate the SDK after API changes:
-## Idioms
+#### Prerequisites
-### HTTP requests
+- Ensure you have Fern CLI installed
+- Navigate to the `fern/` directory of the Fern config repo
+- If you only need regeneration without publishing, you can empty credentials in `generators.yml` to skip the publish step:
+ ```yaml
+ # Example: Clear Maven credentials to skip publish
+ username: ""
+ password: ""
+ signing-key-id: ""
+ ```
-To signal local versus remote methods, calls that result in HTTP requests are performed
-using static methods, for example `User.find()`. The objects returned by static methods
-are built from server responses. The exception to the static idiom is where the `next()`,
-`hasNext()` and `nextPage()` methods on Collections are used to abstract over pagination.
+#### Regeneration Command
-### Pagination
+```bash
+fern generate --group java-sdk
+```
-Some API classes have static `list()` methods that correspond to paginated API responses.
-These return a Collection object (eg `UserCollection`) which can be iterated in two
- ways
-
-- The collection's `getPageItems()`, `hasNextPage()` and `nextPage()` methods - these are useful when you want to fetch one or just a few pages directly.
+#### Common Issues
-- Java's inbuilt iterator methods `next()` and `hasNext()` - these are useful when you want to fetch data without manually handling pagination.
+- **Integration tests failing**: Fix the tests locally and push updates to the PR branch
+- **Spotless formatting errors**: Run the Spotless formatter locally to fix formatting issues
+- **Maven signing errors**: If publishing is enabled, ensure these environment variables are set:
+ - `MAVEN_SIGNING_KEY_ID`
+ - `MAVEN_SIGNING_KEY`
+ - `MAVEN_SIGNING_PASSWORD`
+- **GitHub Actions delays**: If CI is degraded, pipelines may need retries
-### Error handling
+### Publishing to Maven Central
-You do not need to deal with the HTTP response from an API call directly.
-If there is an unsuccessful response then an IntercomException or a subclass
-of IntercomException will be thrown. The exception will have Error objects
- that can be examined via `getErrorCollection` and `getFirstError` for more detail.
-
-The API throws the following runtime exceptions -
-
- - AuthorizationException: for a 401 or 403 response
- - InvalidException: for a 422 response or a local validation failure
- - RateLimitException: for a 429 rate limit exceeded response
- - ClientException: for a general 4xx response
- - ServerException: for a 500 or 503 response
- - IntercomException: general exception
+After regenerating the SDK and merging the PR:
+#### 1. Create a Release Tag
-## Configuration
+Manually create and push a Git tag for the release:
-### HTTP
+```bash
+git tag v4.0.x
+git push origin v4.0.x
+```
-The client can be configured to accept any http stack that implements
-`java.net.HttpURLConnection` by implementing the `HttpConnectorSupplier`
- interface.
-
-For example, to use [OkHttp](http://square.github.io/okhttp/) as a connection
-supplier, create a supplier class -
-
-```java
-public class OkHttpSupplier implements HttpConnectorSupplier {
- private final OkUrlFactory urlFactory;
+#### 2. Trigger Publish Workflow
- public OkHttpSupplier(OkUrlFactory urlFactory) {
- this.urlFactory = urlFactory;
- }
+The tag push triggers the publish workflow automatically. Ensure the version in the repo config aligns with the intended release.
- @Override
- public HttpURLConnection connect(URI uri) throws IOException {
- return urlFactory.open(uri.toURL());
- }
-}
-```
+#### 3. Verify Publication
-and hand a supplier to the Intercom object -
+- Check [Maven Central](https://central.sonatype.com/artifact/io.intercom/intercom-java/overview) for the new version
+- Note: Maven Central indexing can take some time to appear
-```
-final OkHttpClient client = new OkHttpClient();
-final OkUrlFactory factory = new OkUrlFactory(client);
-final OkHttpSupplier supplier = new OkHttpSupplier(factory);
-Intercom.setHttpConnectorSupplier(supplier);
-```
+#### Required Credentials
-#### Timeouts
+Publishing requires:
+- Maven Central credentials (username/password)
+- GPG signing key configuration:
+ - `MAVEN_SIGNING_KEY_ID`
+ - `MAVEN_SIGNING_KEY`
+ - `MAVEN_SIGNING_PASSWORD`
-The default connection and request timeouts can be set in milliseconds using the
-`Intercom.setConnectionTimeout` and `Intercom.setRequestTimeout` methods.
+Contributors without publish credentials can open regeneration PRs. Team members with credentials can complete the publish steps.
+### Example Workflow
-### Target API Server
+1. **Update OpenAPI spec** (if needed): Add overrides in `openapi-overrides.yml` in the Intercom-OpenAPI repo
+2. **Regenerate SDK**: Run `fern generate --group java-sdk`
+3. **Fix any issues**: Address integration test failures or formatting issues
+4. **Create PR**: Open a pull request with the regenerated code
+5. **Merge PR**: After review and approval
+6. **Tag release**: Create and push a Git tag
+7. **Verify publish**: Check Maven Central for the new version
-The base URI to target can be changed for testing purposes
+### Related Resources
-```java
-URI baseURI = new URI("https://example.org/server");
-Intercom.setApiBaseURI(baseURI);
-```
+- [Fern Documentation](https://buildwithfern.com)
+- [Maven Central Repository](https://central.sonatype.com/artifact/io.intercom/intercom-java)
+- [Intercom OpenAPI Spec](https://github.com/intercom/Intercom-OpenAPI)
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f58b503d..2c41feb7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,59 +1,132 @@
-buildscript {
- repositories {
- jcenter()
+plugins {
+ id 'java-library'
+ id 'maven-publish'
+ id 'com.diffplug.spotless' version '6.11.0'
+ id 'signing'
+ id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3'
+}
+
+repositories {
mavenCentral()
- }
- //noinspection GroovyAssignabilityCheck
- dependencies {
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.6'
- classpath 'org.ajoberstar:gradle-git:0.10.0'
- }
+ maven {
+ url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
+ }
}
-allprojects {
- apply plugin: 'idea'
+dependencies {
+ api 'com.squareup.okhttp3:okhttp:5.2.1'
+ api 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
+ api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2'
+ api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
+ testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
+ testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
}
-subprojects {
- buildscript {
- repositories {
- jcenter()
- mavenCentral()
- }
- //noinspection GroovyAssignabilityCheck
- dependencies {
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.6'
- classpath 'org.ajoberstar:gradle-git:0.10.0'
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+
+tasks.withType(Javadoc) {
+ failOnError false
+ options.addStringOption('Xdoclint:none', '-quiet')
+}
+
+spotless {
+ java {
+ palantirJavaFormat()
}
- }
+}
- repositories {
- jcenter()
- mavenCentral()
- }
- apply plugin: 'maven'
- apply plugin: 'maven-publish'
- apply plugin: 'java'
- apply plugin: 'com.jfrog.bintray'
+java {
+ withSourcesJar()
+ withJavadocJar()
+}
+
+
+group = 'io.intercom'
+
+version = '4.0.4'
+
+jar {
+ dependsOn(":generatePomFileForMavenPublication")
+ archiveBaseName = "intercom-java"
+}
+
+sourcesJar {
+ archiveBaseName = "intercom-java"
+}
+
+javadocJar {
+ archiveBaseName = "intercom-java"
+}
+
+signing {
+ sign(publishing.publications)
+}
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
+test {
+ useJUnitPlatform()
+ testLogging {
+ showStandardStreams = true
+ }
+}
- //noinspection GroovyAssignabilityCheck
- dependencies {
- compile 'com.fasterxml.jackson.core:jackson-core:2.4.2'
- compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.2'
- compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
- compile 'com.google.guava:guava:17.0'
- compile 'org.slf4j:slf4j-api:1.7.7'
- compile 'commons-codec:commons-codec:1.9'
- testCompile 'junit:junit:4.11'
- }
+publishing {
+ publications {
+ maven(MavenPublication) {
+ groupId = 'io.intercom'
+ artifactId = 'intercom-java'
+ version = '4.0.4'
+ from components.java
+ pom {
+ name = 'intercom'
+ description = 'The official SDK of intercom'
+ url = 'https://buildwithfern.com'
+ licenses {
+ license {
+ name = 'The MIT License (MIT)'
+ url = 'https://mit-license.org/'
+ }
+ }
+ developers {
+ developer {
+ name = 'intercom'
+ email = 'developers@intercom.com'
+ }
+ }
+ scm {
+ connection = 'scm:git:git://github.com/intercom/intercom-java.git'
+ developerConnection = 'scm:git:git://github.com/intercom/intercom-java.git'
+ url = 'https://github.com/intercom/intercom-java'
+ }
+ }
+ }
+ }
}
+sonatypeCentralUpload {
+ username = "$System.env.MAVEN_USERNAME"
+ password = "$System.env.MAVEN_PASSWORD"
+
+ archives = files(
+ "$buildDir/libs/intercom-java-" + version + ".jar",
+ "$buildDir/libs/intercom-java-" + version + "-sources.jar",
+ "$buildDir/libs/intercom-java-" + version + "-javadoc.jar"
+ )
-task wrapper(type: Wrapper) {
- gradleVersion = '2.0'
+ pom = file("$buildDir/publications/maven/pom-default.xml")
+ signingKey = "$System.env.MAVEN_SIGNATURE_SECRET_KEY"
+ signingKeyPassphrase = "$System.env.MAVEN_SIGNATURE_PASSWORD"
}
+
+signing {
+ def signingKeyId = "$System.env.MAVEN_SIGNATURE_KID"
+ def signingKey = "$System.env.MAVEN_SIGNATURE_SECRET_KEY"
+ def signingPassword = "$System.env.MAVEN_SIGNATURE_PASSWORD"
+ useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
+ sign publishing.publications.maven
+}
+
+sonatypeCentralUpload.dependsOn build
diff --git a/gradle.properties b/gradle.properties
index 8914ba6c..e69de29b 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,8 +0,0 @@
-version: 1.0.3
-
-groupId: io.intercom
-
-modules: \
- intercom-java
-
-org.gradle.daemon: true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index b7612167..1b33c55b 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 09495e50..d4081da4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
-#Wed Sep 24 10:57:43 IST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
diff --git a/gradlew b/gradlew
index 91a7e269..23d15a93 100755
--- a/gradlew
+++ b/gradlew
@@ -1,79 +1,129 @@
-#!/usr/bin/env bash
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
-warn ( ) {
+warn () {
echo "$*"
-}
+} >&2
-die ( ) {
+die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
+CLASSPATH="\\\"\\\""
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -82,83 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
fi
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
fi
- i=$((i+1))
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index aec99730..5eed7ee8 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,4 +1,22 @@
-@if "%DEBUG%" == "" @echo off
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -8,26 +26,30 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
+if %ERRORLEVEL% equ 0 goto execute
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
@@ -35,54 +57,36 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
:execute
@rem Setup the command line
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+set CLASSPATH=
+
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
+if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
diff --git a/init.gradle b/init.gradle
deleted file mode 100644
index ce7f86da..00000000
--- a/init.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-gradle.projectsLoaded {
- rootProject.allprojects {
- buildscript {
- repositories {
- maven{
- url "http://repo.jfrog.org/artifactory/gradle"
- }
- dependencies {
- classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.12')
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/intercom-java/build.gradle b/intercom-java/build.gradle
deleted file mode 100644
index 47243735..00000000
--- a/intercom-java/build.gradle
+++ /dev/null
@@ -1,130 +0,0 @@
-import org.ajoberstar.grgit.Grgit
-import java.text.SimpleDateFormat
-
-final publicationVersion = new Version(version)
-def rawVersion = version
-
-group = 'io.intercom'
-version = publicationVersion
-status = version.status
-ext.publish = true
-
-
-task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = 'sources'
- from sourceSets.main.allSource
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from javadoc.destinationDir
-}
-
-artifacts {
- archives sourcesJar, javadocJar
-}
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- from components.java
-
- artifact sourcesJar {
- classifier "sources"
- }
-
- artifact javadocJar {
- classifier "javadoc"
- }
- }
- }
-}
-
-
-bintray {
- // gradle apslodes if the bintray* props aren't found and we never run this task in circle
- if (System.getenv('release') != null) {
- user = bintrayUser
- key = bintrayKey
- }
- publications = ['mavenJava']
- dryRun = false
- publish = project.publish
- pkg {
- repo = 'intercom-maven'
- userOrg = 'intercom'
- name = 'intercom-java'
- desc = 'Java bindings for the Intercom API'
- websiteUrl = 'https://github.com/intercom/intercom-java'
- issueTrackerUrl = 'https://github.com/intercom/intercom-java/issues'
- vcsUrl = 'https://github.com/intercom/intercom-java.git'
- licenses = ['Apache-2.0']
- labels = ['intercom', 'java', 'api']
- publicDownloadNumbers = true
- //noinspection GroovyAssignabilityCheck
- version {
- name = publicationVersion
- vcsTag = publicationVersion
- }
- }
-}
-
-ext.repo = Grgit.open(project.file('..'))
-
-task printVersion << {
- println "publication version: ${publicationVersion}"
- println "raw version: ${rawVersion}"
-}
-
-task tagRelease << {
- repo.tag.add {
- name = publicationVersion
- message = "Release of ${rawVersion}"
- }
- repo.push(tags: true)
-}
-
-/*
- export release=1 && gradle publishRelease
-*/
-task publishRelease(dependsOn: ['clean', 'tagRelease', 'bintrayUpload'])
-tagRelease.mustRunAfter clean
-bintrayUpload.mustRunAfter tagRelease
-
-
-/**
- * A version object for use in the publication and tagging tasks.
- * If the version ends with SNAPSHOT, that will be replaced with a timestamp.
- *
- * Based on https://github.com/bintray/bintray-examples
- */
-class Version {
- //
- String originalVersion
- String thisVersion
- String status
- Date buildTime
-
- Version(String versionValue) {
- buildTime = new Date()
- originalVersion = versionValue
- if (originalVersion.endsWith('-SNAPSHOT')) {
- status = 'integration'
- thisVersion = originalVersion.substring(0, originalVersion.length() - 'SNAPSHOT'.length()) + getTimestamp()
- } else {
- status = 'release'
- thisVersion = versionValue
- }
- }
-
- String getTimestamp() {
- // Convert local file timestamp to UTC
- def format = new SimpleDateFormat('yyyyMMddHHmmss')
- format.setCalendar(Calendar.getInstance(TimeZone.getTimeZone('UTC')));
- return format.format(buildTime)
- }
-
- String toString() {
- thisVersion
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Admin.java b/intercom-java/src/main/java/io/intercom/api/Admin.java
deleted file mode 100644
index 3f8cb0aa..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Admin.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package io.intercom.api;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-
-import java.util.Map;
-
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Admin extends TypedData implements Replier {
-
- private static final Map SENTINEL = Maps.newHashMap();
-
- public static final String TYPE_NOBODY = "nobody_admin";
-
- // don't make public for now
- static AdminCollection list(Map params)
- throws AuthorizationException, ClientException, ServerException, InvalidException, RateLimitException {
- return DataResource.list(params, "admins", AdminCollection.class);
- }
-
- public static AdminCollection list()
- throws AuthorizationException, ClientException, ServerException, InvalidException, RateLimitException {
- return DataResource.list(SENTINEL, "admins", AdminCollection.class);
- }
-
- @SuppressWarnings("FieldCanBeLocal")
- @JsonProperty("type")
- private final String type = "admin";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("name")
- private String name;
-
- @JsonProperty("email")
- private String email;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("updated_at")
- private long updatedAt;
-
- @JsonProperty("open")
- private long open;
-
- @JsonProperty("closed")
- private long closed;
-
- public Admin() {
- }
-
- public String getReplyType() {
- return getType() + "_reply";
- }
-
- public String getType() {
- return type;
- }
-
- @JsonIgnore
- public boolean isNobody() {
- return TYPE_NOBODY.equalsIgnoreCase(getType());
- }
-
- @JsonIgnore
- public boolean isSomebody() {
- return (!isNobody()) && (getId() != null);
- }
-
- public String getId() {
- return id;
- }
-
- public Admin setId(String id) {
- this.id = id;
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public String getEmail() {
- return email;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public long getUpdatedAt() {
- return updatedAt;
- }
-
- public long getOpen() {
- return open;
- }
-
- public long getClosed() {
- return closed;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Admin admin = (Admin) o;
-
- if (closed != admin.closed) return false;
- if (createdAt != admin.createdAt) return false;
- if (open != admin.open) return false;
- if (updatedAt != admin.updatedAt) return false;
- if (email != null ? !email.equals(admin.email) : admin.email != null) return false;
- if (id != null ? !id.equals(admin.id) : admin.id != null) return false;
- if (name != null ? !name.equals(admin.name) : admin.name != null) return false;
- //noinspection RedundantIfStatement
- if (!type.equals(admin.type)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (email != null ? email.hashCode() : 0);
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
- result = 31 * result + (int) (open ^ (open >>> 32));
- result = 31 * result + (int) (closed ^ (closed >>> 32));
- return result;
- }
-
- @Override
- public String toString() {
- return "Admin{" +
- "id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", email='" + email + '\'' +
- ", createdAt=" + createdAt +
- ", updatedAt=" + updatedAt +
- "} " + super.toString();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/AdminCollection.java b/intercom-java/src/main/java/io/intercom/api/AdminCollection.java
deleted file mode 100644
index 7f37a2a5..00000000
--- a/intercom-java/src/main/java/io/intercom/api/AdminCollection.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Iterator;
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class AdminCollection extends TypedDataCollection implements Iterator {
- protected TypedDataCollectionIterator iterator;
-
- public AdminCollection() {
- type = "company.list";
- iterator = new TypedDataCollectionIterator(this);
- }
-
- @Override
- public AdminCollection nextPage() {
- return fetchNextPage(AdminCollection.class);
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("admins")
- @Override
- public List getPage() {
- return super.getPage();
- }
-
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public Admin next() {
- return iterator.next();
- }
-
- public void remove() {
- iterator.remove();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/AdminMessage.java b/intercom-java/src/main/java/io/intercom/api/AdminMessage.java
deleted file mode 100644
index 24f253ab..00000000
--- a/intercom-java/src/main/java/io/intercom/api/AdminMessage.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package io.intercom.api;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.annotations.VisibleForTesting;
-
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class AdminMessage extends TypedData {
-
- @JsonProperty("type")
- private final String type = "admin_message";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("message_type")
- private String messageType;
-
- @JsonProperty("subject")
- private String subject;
-
- @JsonProperty("body")
- private String body;
-
- @JsonProperty("template")
- private String template;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("from")
- private Admin admin;
-
- @JsonProperty("to")
- private User user;
-
- public AdminMessage() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getId() {
- return id;
- }
-
- @SuppressWarnings("UnusedReturnValue")
- @VisibleForTesting
- AdminMessage setId(String id) {
- this.id = id;
- return this;
- }
-
- public String getMessageType() {
- return messageType;
- }
-
- public AdminMessage setMessageType(String messageType) {
- this.messageType = messageType;
- return this;
- }
-
- public String getSubject() {
- return subject;
- }
-
- public AdminMessage setSubject(String subject) {
- this.subject = subject;
- return this;
- }
-
- public String getBody() {
- return body;
- }
-
- public AdminMessage setBody(String body) {
- this.body = body;
- return this;
- }
-
- public String getTemplate() {
- return template;
- }
-
- public AdminMessage setTemplate(String template) {
- this.template = template;
- return this;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- @SuppressWarnings("UnusedReturnValue")
- public AdminMessage setCreatedAt(long createdAt) {
- this.createdAt = createdAt;
- return this;
- }
-
- public Admin getAdmin() {
- return admin;
- }
-
- public AdminMessage setAdmin(Admin admin) {
- this.admin = admin;
- return this;
- }
-
- public User getUser() {
- return user;
- }
-
- public AdminMessage setUser(User user) {
- this.user = user;
- return this;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- AdminMessage message = (AdminMessage) o;
-
- if (createdAt != message.createdAt) return false;
- if (admin != null ? !admin.equals(message.admin) : message.admin != null) return false;
- if (body != null ? !body.equals(message.body) : message.body != null) return false;
- if (id != null ? !id.equals(message.id) : message.id != null) return false;
- if (messageType != null ? !messageType.equals(message.messageType) : message.messageType != null) return false;
- if (subject != null ? !subject.equals(message.subject) : message.subject != null) return false;
- if (template != null ? !template.equals(message.template) : message.template != null) return false;
- if (!type.equals(message.type)) return false;
- //noinspection RedundantIfStatement
- if (user != null ? !user.equals(message.user) : message.user != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (messageType != null ? messageType.hashCode() : 0);
- result = 31 * result + (subject != null ? subject.hashCode() : 0);
- result = 31 * result + (body != null ? body.hashCode() : 0);
- result = 31 * result + (template != null ? template.hashCode() : 0);
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (admin != null ? admin.hashCode() : 0);
- result = 31 * result + (user != null ? user.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "AdminMessage{" +
- "id='" + id + '\'' +
- ", messageType='" + messageType + '\'' +
- ", subject='" + subject + '\'' +
- ", body='" + body + '\'' +
- ", template='" + template + '\'' +
- ", createdAt=" + createdAt +
- ", admin=" + admin +
- ", user=" + user +
- "} " + super.toString();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/AdminMessageResponse.java b/intercom-java/src/main/java/io/intercom/api/AdminMessageResponse.java
deleted file mode 100644
index 9e55d20e..00000000
--- a/intercom-java/src/main/java/io/intercom/api/AdminMessageResponse.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package io.intercom.api;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-class AdminMessageResponse extends TypedData {
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("message_type")
- private String messageType;
-
- @JsonProperty("subject")
- private String subject;
-
- @JsonProperty("body")
- private String body;
-
- @JsonProperty("template")
- private String template;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("updated_at")
- private long updatedAt;
-
- @JsonProperty("owner")
- private Admin admin;
-
- @JsonProperty("to")
- private User user;
-
- public AdminMessageResponse() {
- }
-
- public String getType() {
- return "admin_message";
- }
-
- public String getId() {
- return id;
- }
-
- public AdminMessageResponse setId(String id) {
- this.id = id;
- return this;
- }
-
- public String getMessageType() {
- return messageType;
- }
-
- public AdminMessageResponse setMessageType(String messageType) {
- this.messageType = messageType;
- return this;
- }
-
- public String getSubject() {
- return subject;
- }
-
- public AdminMessageResponse setSubject(String subject) {
- this.subject = subject;
- return this;
- }
-
- public String getBody() {
- return body;
- }
-
- public AdminMessageResponse setBody(String body) {
- this.body = body;
- return this;
- }
-
- public String getTemplate() {
- return template;
- }
-
- public AdminMessageResponse setTemplate(String template) {
- this.template = template;
- return this;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public AdminMessageResponse setCreatedAt(long createdAt) {
- this.createdAt = createdAt;
- return this;
- }
-
- public long getUpdatedAt() {
- return updatedAt;
- }
-
- public AdminMessageResponse setUpdatedAt(long updatedAt) {
- this.updatedAt = updatedAt;
- return this;
- }
-
- public Admin getAdmin() {
- return admin;
- }
-
- public AdminMessageResponse setAdmin(Admin admin) {
- this.admin = admin;
- return this;
- }
-
- public User getUser() {
- return user;
- }
-
- public AdminMessageResponse setUser(User user) {
- this.user = user;
- return this;
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/AdminReply.java b/intercom-java/src/main/java/io/intercom/api/AdminReply.java
deleted file mode 100644
index 473c4a70..00000000
--- a/intercom-java/src/main/java/io/intercom/api/AdminReply.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package io.intercom.api;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class AdminReply extends Reply {
-
- @SuppressWarnings("UnusedDeclaration")
- @JsonIgnoreProperties(ignoreUnknown = true)
- @JsonInclude(JsonInclude.Include.NON_EMPTY)
- static class AdminStringReply {
-
- private AdminReply reply;
-
- public AdminStringReply(AdminReply reply) {
- this.reply = reply;
- }
-
- @JsonProperty("type")
- public String getType() {
- return reply.getType();
- }
-
- @JsonProperty("message_type")
- public String getMessageType() {
- return reply.getMessageType();
- }
-
- @JsonProperty("body")
- public String getBody() {
- return reply.getBody();
- }
-
- @JsonProperty("admin_id")
- public String getAdminID() {
- return reply.getFrom().getId();
- }
- }
-
- public AdminReply(Admin admin) {
- this.from = admin;
- }
-
- @Override
- public String toString() {
- return "AdminReply{} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Author.java b/intercom-java/src/main/java/io/intercom/api/Author.java
deleted file mode 100644
index 204c84b9..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Author.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package io.intercom.api;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Author extends TypedData {
-
- @JsonProperty("type")
- private String type;
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("name")
- private String name;
-
- @JsonProperty("email")
- private String email;
-
- @JsonProperty("user_id")
- private String userId;
-
- public Author() {
- }
-
- public String getType() {
- return type;
- }
-
- @JsonIgnore
- public boolean isUser() {
- return "user".equalsIgnoreCase(getType());
- }
-
- @JsonIgnore
- public boolean isAdmin() {
- return "admin".equalsIgnoreCase(getType());
- }
-
- public String getId() {
- return id;
- }
-
- public Author setId(String id) {
- this.id = id;
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public Author setName(String name) {
- this.name = name;
- return this;
- }
-
- public String getEmail() {
- return email;
- }
-
- public Author setEmail(String email) {
- this.email = email;
- return this;
- }
-
- public String getUserId() {
- return userId;
- }
-
- public Author setUserId(String userId) {
- this.userId = userId;
- return this;
- }
-
- @Override
- public int hashCode() {
- int result = id != null ? id.hashCode() : 0;
- result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (email != null ? email.hashCode() : 0);
- result = 31 * result + (userId != null ? userId.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Author author = (Author) o;
-
- if (email != null ? !email.equals(author.email) : author.email != null) return false;
- if (id != null ? !id.equals(author.id) : author.id != null) return false;
- if (name != null ? !name.equals(author.name) : author.name != null) return false;
- //noinspection RedundantIfStatement
- if (userId != null ? !userId.equals(author.userId) : author.userId != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return "Author{" +
- "id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", email='" + email + '\'' +
- ", userId='" + userId + '\'' +
- "} " + super.toString();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/AuthorizationException.java b/intercom-java/src/main/java/io/intercom/api/AuthorizationException.java
deleted file mode 100644
index 4ecc7584..00000000
--- a/intercom-java/src/main/java/io/intercom/api/AuthorizationException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.intercom.api;
-
-public class AuthorizationException extends IntercomException {
-
- private static final long serialVersionUID = 2917082281352001861L;
-
- public AuthorizationException(String message) {
- super(message);
- }
-
- public AuthorizationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public AuthorizationException(ErrorCollection errorCollection) {
- super(errorCollection);
- }
-
- public AuthorizationException(ErrorCollection errorCollection, Throwable cause) {
- super(errorCollection, cause);
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Avatar.java b/intercom-java/src/main/java/io/intercom/api/Avatar.java
deleted file mode 100644
index 7cfd9897..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Avatar.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.intercom.api;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.net.URI;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_DEFAULT)
-public class Avatar extends TypedData {
-
- @JsonProperty("type")
- private final String type = "avatar";
-
- @JsonProperty("image_url")
- private URI imageURL;
-
- Avatar() {
- }
-
- public String getType() {
- return type;
- }
-
- public URI getImageURL() {
- return imageURL;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Avatar avatar = (Avatar) o;
-
- if (imageURL != null ? !imageURL.equals(avatar.imageURL) : avatar.imageURL != null) return false;
- //noinspection RedundantIfStatement
- if (!type.equals(avatar.type)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (imageURL != null ? imageURL.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "Avatar{" +
- "type='" + type + '\'' +
- ", imageURL=" + imageURL +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/ClientException.java b/intercom-java/src/main/java/io/intercom/api/ClientException.java
deleted file mode 100644
index e670983f..00000000
--- a/intercom-java/src/main/java/io/intercom/api/ClientException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.intercom.api;
-
-public class ClientException extends IntercomException {
-
- private static final long serialVersionUID = -2111295679006526646L;
-
- public ClientException(String message) {
- super(message);
- }
-
- public ClientException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ClientException(ErrorCollection errorCollection) {
- super(errorCollection);
- }
-
- public ClientException(ErrorCollection errorCollection, Throwable cause) {
- super(errorCollection, cause);
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Company.java b/intercom-java/src/main/java/io/intercom/api/Company.java
deleted file mode 100644
index 773097eb..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Company.java
+++ /dev/null
@@ -1,394 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Maps;
-
-import java.net.URI;
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonInclude(JsonInclude.Include.NON_DEFAULT)
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class Company extends TypedData {
-
- private static final Map SENTINEL = Maps.newHashMap();
-
- public static Company find(String id) throws InvalidException, AuthorizationException {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path("companies").path(id).build());
- return resource.get(Company.class);
- }
-
- public static Company find(Map params) throws InvalidException, AuthorizationException {
- if (!params.containsKey("company_id") && !params.containsKey("name")) {
- throw new InvalidException("a company find must include a company_id or name parameter");
- }
- return DataResource.find(params, "companies", Company.class);
- }
-
- public static Company create(Company company) throws InvalidException, AuthorizationException {
- return update(company);
- }
-
- public static Company update(Company company) throws InvalidException, AuthorizationException {
- // because the data is asymmetric on the plan field
- final CompanyWithStringPlan entity = new CompanyWithStringPlan();
- entity.setCompanyID(company.getCompanyID());
- entity.setName(company.getName());
- entity.setSessionCount(company.getSessionCount());
- entity.setMonthlySpend(company.getMonthlySpend());
- entity.setRemoteCreatedAt(company.getRemoteCreatedAt());
- if(company.getCustomAttributes() != null) {
- entity.getCustomAttributes().putAll(company.getCustomAttributes());
- }
- if(company.getPlan() !=null ) {
- entity.setPlan(company.getPlan().getName());
- }
- return DataResource.update(entity, "companies", Company.class);
- }
-
- public static Company delete(String id) throws InvalidException, AuthorizationException {
- return DataResource.delete(id, "companies", Company.class);
- }
-
- public static CompanyCollection list(Map params) throws InvalidException, AuthorizationException {
- return DataResource.list(params, "companies", CompanyCollection.class);
- }
-
- public static CompanyCollection list() throws InvalidException, AuthorizationException {
- return DataResource.list(SENTINEL, "companies", CompanyCollection.class);
- }
-
- public static UserCollection listUsers(Map params) throws InvalidException, AuthorizationException {
- URI usersURI;
- if (params.containsKey("company_id")) {
- usersURI = UriBuilder.newBuilder()
- .path("companies")
- .query("company_id", params.get("company_id"))
- .query("type", "users")
- .build();
- } else if (params.containsKey("id")) {
- usersURI = UriBuilder.newBuilder()
- .path("companies")
- .path(params.get("id"))
- .path("users")
- .build();
- } else {
- throw new InvalidException("a company user list query must supply a company_id or id parameter");
- }
- final HttpClient resource = new HttpClient(usersURI);
- return resource.get(UserCollection.class);
- }
-
- @SuppressWarnings("UnusedDeclaration")
- @JsonInclude(JsonInclude.Include.NON_DEFAULT)
- @JsonIgnoreProperties(ignoreUnknown = true)
- public static class Plan extends TypedData {
-
- @JsonProperty("type")
- protected String type;
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("name")
- private String name;
-
- public Plan() {
- type = "plan";
- }
-
- public Plan(String name) {
- this();
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getType() {
- return type;
- }
-
- @Override
- public int hashCode() {
- int result = id != null ? id.hashCode() : 0;
- result = 31 * result + (name != null ? name.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Plan plan = (Plan) o;
-
- if (id != null ? !id.equals(plan.id) : plan.id != null) return false;
- //noinspection RedundantIfStatement
- if (name != null ? !name.equals(plan.name) : plan.name != null) return false;
-
- return true;
- }
-
-
- @Override
- public String toString() {
- return "Plan{" +
- "id='" + id + '\'' +
- ", name='" + name + '\'' +
- "} " + super.toString();
- }
-
-
- }
-
- @SuppressWarnings("FieldCanBeLocal")
- @JsonProperty("type")
- private final String type = "company";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("name")
- private String name;
-
- @JsonProperty("company_id")
- private String companyID;
-
- @JsonProperty("session_count")
- private int sessionCount;
-
- @JsonProperty("monthly_spend")
- private float monthlySpend;
-
- @JsonProperty("remote_created_at")
- private long remoteCreatedAt;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("updated_at")
- private long updatedAt;
-
- @JsonProperty("plan")
- private Plan plan;
-
- @JsonProperty("user_count")
- private Integer userCount;
-
- @JsonIgnoreProperties(ignoreUnknown = false)
- @JsonProperty("custom_attributes")
- private Map customAttributes = Maps.newHashMap();
-
- @JsonProperty("segments")
- private SegmentCollection segmentCollection = new SegmentCollection();
-
- @JsonProperty("tags")
- private TagCollection tagCollection = new TagCollection();
-
- private Boolean untag;
-
- public Company() {
- }
-
- public Company untag() {
- untag = Boolean.TRUE;
- return this;
- }
-
- public String getType() {
- return type;
- }
-
- public String getId() {
- return id;
- }
-
- @VisibleForTesting
- Company setId(String id) {
- this.id = id;
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public Company setName(String name) {
- this.name = name;
- return this;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public long getUpdatedAt() {
- return updatedAt;
- }
-
- public String getCompanyID() {
- return companyID;
- }
-
- public Company setCompanyID(String companyID) {
- this.companyID = companyID;
- return this;
- }
-
- public int getSessionCount() {
- return sessionCount;
- }
-
- /**
- * Deprecated. The Intercom API does not support changing the
- * session value for a company. Calling this method has no
- * effect.
- *
- * @param sessionCount this value is ignored
- * @return the company object
- */
- @Deprecated
- public Company setSessionCount(int sessionCount) {
- return this;
- }
-
- public long getRemoteCreatedAt() {
- return remoteCreatedAt;
- }
-
- public Company setRemoteCreatedAt(long remoteCreatedAt) {
- this.remoteCreatedAt = remoteCreatedAt;
- return this;
- }
-
- public Map getCustomAttributes() {
- return customAttributes;
- }
-
- public Company setCustomAttributes(Map customAttributes) {
- this.customAttributes = customAttributes;
- return this;
- }
-
- public Company addCustomAttribute(CustomAttribute customAttribute) {
- this.customAttributes.put(customAttribute.getName(), customAttribute);
- return this;
- }
-
- public Plan getPlan() {
- return plan;
- }
-
- public Company setPlan(Plan plan) {
- this.plan = plan;
- return this;
- }
-
- public Integer getUserCount() {
- return userCount;
- }
-
- public float getMonthlySpend() {
- return monthlySpend;
- }
-
- public Company setMonthlySpend(float monthlySpend) {
- this.monthlySpend = monthlySpend;
- return this;
- }
-
- public SegmentCollection getSegmentCollection() {
- return segmentCollection;
- }
-
- public TagCollection getTagCollection() {
- return tagCollection;
- }
-
- boolean isUntag() {
- return untag == null ? false : untag;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Company company = (Company) o;
-
- if (createdAt != company.createdAt) return false;
- if (Float.compare(company.monthlySpend, monthlySpend) != 0) return false;
- if (remoteCreatedAt != company.remoteCreatedAt) return false;
- if (sessionCount != company.sessionCount) return false;
- if (updatedAt != company.updatedAt) return false;
- if (companyID != null ? !companyID.equals(company.companyID) : company.companyID != null) return false;
- if (customAttributes != null ? !customAttributes.equals(company.customAttributes) : company.customAttributes != null)
- return false;
- if (id != null ? !id.equals(company.id) : company.id != null) return false;
- if (name != null ? !name.equals(company.name) : company.name != null) return false;
- if (plan != null ? !plan.equals(company.plan) : company.plan != null) return false;
- if (segmentCollection != null ? !segmentCollection.equals(company.segmentCollection) : company.segmentCollection != null)
- return false;
- if (tagCollection != null ? !tagCollection.equals(company.tagCollection) : company.tagCollection != null)
- return false;
- if (!type.equals(company.type)) return false;
- if (untag != null ? !untag.equals(company.untag) : company.untag != null) return false;
- //noinspection RedundantIfStatement
- if (userCount != null ? !userCount.equals(company.userCount) : company.userCount != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (companyID != null ? companyID.hashCode() : 0);
- result = 31 * result + sessionCount;
- result = 31 * result + (monthlySpend != +0.0f ? Float.floatToIntBits(monthlySpend) : 0);
- result = 31 * result + (int) (remoteCreatedAt ^ (remoteCreatedAt >>> 32));
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
- result = 31 * result + (plan != null ? plan.hashCode() : 0);
- result = 31 * result + (userCount != null ? userCount.hashCode() : 0);
- result = 31 * result + (customAttributes != null ? customAttributes.hashCode() : 0);
- result = 31 * result + (segmentCollection != null ? segmentCollection.hashCode() : 0);
- result = 31 * result + (tagCollection != null ? tagCollection.hashCode() : 0);
- result = 31 * result + (untag != null ? untag.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "Company{" +
- "id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", companyID='" + companyID + '\'' +
- ", sessionCount=" + sessionCount +
- ", monthlySpend=" + monthlySpend +
- ", remoteCreatedAt=" + remoteCreatedAt +
- ", createdAt=" + createdAt +
- ", updatedAt=" + updatedAt +
- ", plan=" + plan +
- ", customAttributes=" + customAttributes +
- ", segmentCollection=" + segmentCollection +
- ", tagCollection=" + tagCollection +
- "} " + super.toString();
- }
-
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/CompanyCollection.java b/intercom-java/src/main/java/io/intercom/api/CompanyCollection.java
deleted file mode 100644
index 37f8019e..00000000
--- a/intercom-java/src/main/java/io/intercom/api/CompanyCollection.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Iterator;
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class CompanyCollection extends TypedDataCollection implements Iterator {
-
- protected TypedDataCollectionIterator iterator;
-
- @JsonProperty("total_count")
- private long totalCount;
-
- public CompanyCollection() {
- type = "company.list";
- iterator = new TypedDataCollectionIterator(this);
- }
-
- public CompanyCollection(List companies) {
- this();
- this.page = companies;
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("companies")
- @Override
- public List getPage() {
- return super.getPage();
- }
-
- public long getTotalCount() {
- return totalCount;
- }
-
- @Override
- public CompanyCollection nextPage() {
- return fetchNextPage(CompanyCollection.class);
- }
-
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public Company next() {
- return iterator.next();
- }
-
- public void remove() {
- iterator.remove();
- }
-
- @Override
- public String toString() {
- return "CompanyCollection{" +
- ", totalCount=" + totalCount +
- "} " + super.toString();
- }
-
- void addCompany(Company company) {
- page.add(company);
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/CompanyWithStringPlan.java b/intercom-java/src/main/java/io/intercom/api/CompanyWithStringPlan.java
deleted file mode 100644
index 1c8387f5..00000000
--- a/intercom-java/src/main/java/io/intercom/api/CompanyWithStringPlan.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonInclude(JsonInclude.Include.NON_DEFAULT)
-@JsonIgnoreProperties(ignoreUnknown = true)
-class CompanyWithStringPlan extends TypedData {
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("name")
- private String name;
-
- @JsonProperty("company_id")
- private String companyID;
-
- @JsonProperty("session_count")
- private int sessionCount;
-
- @JsonProperty("monthly_spend")
- private float monthlySpend;
-
- @JsonProperty("remote_created_at")
- private long remoteCreatedAt;
-
- @JsonProperty("plan")
- private String plan;
-
- @JsonIgnoreProperties(ignoreUnknown = false)
- @JsonProperty("custom_attributes")
- private Map customAttributes = Maps.newHashMap();
-
- public CompanyWithStringPlan() {
- }
-
- public String getType() {
- return "company";
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getCompanyID() {
- return companyID;
- }
-
- public void setCompanyID(String companyID) {
- this.companyID = companyID;
- }
-
- public Integer getSessionCount() {
- return sessionCount;
- }
-
- public void setSessionCount(Integer sessionCount) {
- this.sessionCount = sessionCount;
- }
-
- public float getMonthlySpend() {
- return monthlySpend;
- }
-
- public void setMonthlySpend(float monthlySpend) {
- this.monthlySpend = monthlySpend;
- }
-
- public long getRemoteCreatedAt() {
- return remoteCreatedAt;
- }
-
- public void setRemoteCreatedAt(long remoteCreatedAt) {
- this.remoteCreatedAt = remoteCreatedAt;
- }
-
- public String getPlan() {
- return plan;
- }
-
- public void setPlan(String plan) {
- this.plan = plan;
- }
-
- public Map getCustomAttributes() {
- return customAttributes;
- }
-
- public void setCustomAttributes(Map customAttributes) {
- this.customAttributes = customAttributes;
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Conversation.java b/intercom-java/src/main/java/io/intercom/api/Conversation.java
deleted file mode 100644
index c8e35cf0..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Conversation.java
+++ /dev/null
@@ -1,267 +0,0 @@
-package io.intercom.api;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.Optional;
-import com.google.common.collect.Maps;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class Conversation extends TypedData {
-
- private static final HashMap SENTINEL = Maps.newHashMap();
-
- public static Conversation find(String id) throws InvalidException, AuthorizationException {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path("conversations").path(id).build());
- return resource.get(Conversation.class);
- }
-
- public static ConversationCollection list() throws InvalidException, AuthorizationException {
- return DataResource.list(SENTINEL, "conversations", ConversationCollection.class);
- }
-
- public static ConversationCollection list(Map params) throws InvalidException, AuthorizationException {
- if (!params.containsKey("type")) {
- throw new InvalidException("a user or admin type must be supplied for a conversation query");
- }
-
- if (isAdminQuery(params)
- && !(params.containsKey("admin_id"))) {
- throw new InvalidException("an admin_id must be supplied for an admin conversation query");
- }
-
- if (isUserQuery(params)
- && (!params.containsKey("intercom_user_id")
- && !params.containsKey("user_id")
- && !params.containsKey("email"))) {
- throw new InvalidException(
- "One of intercom_user_id, user_id or email must be supplied for a user conversation query");
- }
-
- return DataResource.list(params, "conversations", ConversationCollection.class);
- }
-
- public static Conversation reply(String id, UserReply reply) {
- final URI uri = UriBuilder.newBuilder()
- .path("conversations")
- .path(id)
- .path("reply")
- .build();
- return new HttpClient(uri)
- .post(Conversation.class, new UserReply.UserStringReply(reply));
- }
-
- public static Conversation reply(String id, AdminReply reply) {
- final URI uri = UriBuilder.newBuilder()
- .path("conversations")
- .path(id)
- .path("reply")
- .build();
- return new HttpClient(uri)
- .post(Conversation.class, new AdminReply.AdminStringReply(reply));
- }
-
- public static UserMessage create(UserMessage message) {
- return DataResource.create(message, "messages", UserMessage.class);
- }
-
- public static AdminMessage create(AdminMessage message) throws InvalidException {
- if ((!message.getTemplate().equals("plain")) && (!message.getTemplate().equals("personal"))) {
- throw new InvalidException("The template must be either personal or plain");
- }
- if ((!message.getMessageType().equals("email")) && (!message.getMessageType().equals("inapp"))) {
- throw new InvalidException("The message type must be either email or inapp");
- }
- /*
- the message api is asymmetric because reasons. this wraps the response
- type so we only expose AdminMessage in the client surface
- */
- final AdminMessageResponse adminMessageResponse =
- DataResource.create(message, "messages", AdminMessageResponse.class);
- AdminMessage response = new AdminMessage();
- response.setAdmin(adminMessageResponse.getAdmin());
- response.setBody(adminMessageResponse.getBody());
- response.setCreatedAt(adminMessageResponse.getCreatedAt());
- response.setId(adminMessageResponse.getId());
- response.setMessageType(adminMessageResponse.getMessageType());
- response.setSubject(adminMessageResponse.getSubject());
- response.setTemplate(adminMessageResponse.getTemplate());
- // user returns null
- // response.setUser(adminMessageResponse.getFrom());
- return response;
- }
-
- private static boolean isUserQuery(Map params) {
- return params.containsKey("type") && params.get("type").equals("user");
- }
-
- private static boolean isAdminQuery(Map params) {
- return params.containsKey("type") && params.get("type").equals("admin");
- }
-
- @JsonProperty("type")
- private final String type = "conversation";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("conversation_message")
- private ConversationMessage conversationMessage;
-
- @JsonProperty("user")
- private User user;
-
- @JsonProperty("assignee")
- private Admin assignee;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("updated_at")
- private long updatedAt;
-
- @JsonProperty("conversation_parts")
- private ConversationPartCollection conversationPartCollection;
-
- @JsonProperty("open")
- private boolean open;
-
- @JsonProperty("read")
- private boolean read;
-
- @JsonProperty("links")
- private Map links;
-
- public Conversation() {
- }
-
- public String getType() {
- return type;
- }
-
- public Admin getCurrentAssignee() {
- Admin assignee = null;
- if (getAssignee() != null) {
- assignee = getAssignee();
- } else if (getMostRecentConversationPart() != null && getMostRecentConversationPart().getAssignedTo() != null) {
- assignee = getMostRecentConversationPart().getAssignedTo();
- }
-
- return assignee;
- }
-
- public Optional getFirstConversationPart() {
- return Optional.fromNullable(getConversationPartCollection().getPage().get(0));
- }
-
- public ConversationPart getMostRecentConversationPart() {
- final ConversationPartCollection conversationParts = getConversationPartCollection();
- final List items = conversationParts.getPage();
- if (items.isEmpty()) {
- return null;
- } else {
- return items.get(items.size() - 1);
- }
- }
-
- public String getId() {
- return id;
- }
-
- public ConversationMessage getConversationMessage() {
- return conversationMessage;
- }
-
- public User getUser() {
- return user;
- }
-
- public Admin getAssignee() {
- return assignee;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public long getUpdatedAt() {
- return updatedAt;
- }
-
- public ConversationPartCollection getConversationPartCollection() {
- return conversationPartCollection;
- }
-
- public boolean getOpen() {
- return open;
- }
-
- public boolean getRead() {
- return read;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Conversation that = (Conversation) o;
-
- if (createdAt != that.createdAt) return false;
- if (open != that.open) return false;
- if (read != that.read) return false;
- if (updatedAt != that.updatedAt) return false;
- if (assignee != null ? !assignee.equals(that.assignee) : that.assignee != null) return false;
- if (conversationMessage != null ? !conversationMessage.equals(that.conversationMessage) : that.conversationMessage != null)
- return false;
- if (conversationPartCollection != null ? !conversationPartCollection.equals(that.conversationPartCollection) : that.conversationPartCollection != null)
- return false;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (links != null ? !links.equals(that.links) : that.links != null) return false;
- if (!type.equals(that.type)) return false;
- //noinspection RedundantIfStatement
- if (user != null ? !user.equals(that.user) : that.user != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (conversationMessage != null ? conversationMessage.hashCode() : 0);
- result = 31 * result + (user != null ? user.hashCode() : 0);
- result = 31 * result + (assignee != null ? assignee.hashCode() : 0);
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
- result = 31 * result + (conversationPartCollection != null ? conversationPartCollection.hashCode() : 0);
- result = 31 * result + (open ? 1 : 0);
- result = 31 * result + (read ? 1 : 0);
- result = 31 * result + (links != null ? links.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "Conversation{" +
- "type='" + type + '\'' +
- ", id='" + id + '\'' +
- ", conversationMessage=" + conversationMessage +
- ", user=" + user +
- ", assignee=" + assignee +
- ", createdAt=" + createdAt +
- ", updatedAt=" + updatedAt +
- ", conversationPartCollection=" + conversationPartCollection +
- ", open=" + open +
- ", read=" + read +
- ", links=" + links +
- "} " + super.toString();
- }
-}
-
diff --git a/intercom-java/src/main/java/io/intercom/api/ConversationCollection.java b/intercom-java/src/main/java/io/intercom/api/ConversationCollection.java
deleted file mode 100644
index 68251f0c..00000000
--- a/intercom-java/src/main/java/io/intercom/api/ConversationCollection.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Iterator;
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ConversationCollection extends TypedDataCollection implements Iterator {
-
- protected TypedDataCollectionIterator iterator;
-
- public ConversationCollection() {
- type = "conversation.list";
- iterator = new TypedDataCollectionIterator(this);
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("conversations")
- public List getPage() {
- return super.getPage();
- }
-
- @Override
- public ConversationCollection nextPage() {
- return fetchNextPage(ConversationCollection.class);
- }
-
-
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public Conversation next() {
- return iterator.next();
- }
-
- public void remove() {
- iterator.remove();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/ConversationMessage.java b/intercom-java/src/main/java/io/intercom/api/ConversationMessage.java
deleted file mode 100644
index 328a7b3b..00000000
--- a/intercom-java/src/main/java/io/intercom/api/ConversationMessage.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ConversationMessage extends TypedData {
-
- @SuppressWarnings("FieldCanBeLocal")
- @JsonProperty("type")
- private final String type = "conversation_message";
-
- @JsonProperty
- private String subject;
-
- @JsonProperty
- private String body;
-
- @JsonProperty
- private Author author;
-
- public ConversationMessage() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getSubject() {
- return subject;
- }
-
- public String getBody() {
- return body;
- }
-
- public Author getAuthor() {
- return author;
- }
-
- @Override
- public int hashCode() {
- int result = subject != null ? subject.hashCode() : 0;
- result = 31 * result + (body != null ? body.hashCode() : 0);
- result = 31 * result + (author != null ? author.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ConversationMessage that = (ConversationMessage) o;
-
- if (author != null ? !author.equals(that.author) : that.author != null) return false;
- if (body != null ? !body.equals(that.body) : that.body != null) return false;
- //noinspection RedundantIfStatement
- if (subject != null ? !subject.equals(that.subject) : that.subject != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return "ConversationMessage{" +
- "type='" + type + '\'' +
- ", subject='" + subject + '\'' +
- ", body='" + body + '\'' +
- ", author=" + author +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/ConversationPart.java b/intercom-java/src/main/java/io/intercom/api/ConversationPart.java
deleted file mode 100644
index 74240721..00000000
--- a/intercom-java/src/main/java/io/intercom/api/ConversationPart.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ConversationPart extends TypedData {
-
- @JsonProperty("type")
- private final String type = "conversation_part";
-
- @JsonProperty
- private String id;
-
- @JsonProperty("part_type")
- private String partType;
-
- @JsonProperty
- private String body;
-
- @JsonProperty
- private Author author;
-
- @JsonProperty("assigned_to")
- private Admin assignedTo;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("updated_at")
- private long updatedAt;
-
- @JsonProperty("notified_at")
- private long NotifiedAt;
-
- public ConversationPart() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getId() {
- return id;
- }
-
- public String getPartType() {
- return partType;
- }
-
- public String getBody() {
- return body;
- }
-
- public Author getAuthor() {
- return author;
- }
-
- public Admin getAssignedTo() {
- return assignedTo;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public long getUpdatedAt() {
- return updatedAt;
- }
-
- public long getNotifiedAt() {
- return NotifiedAt;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ConversationPart that = (ConversationPart) o;
-
- if (NotifiedAt != that.NotifiedAt) return false;
- if (createdAt != that.createdAt) return false;
- if (updatedAt != that.updatedAt) return false;
- if (assignedTo != null ? !assignedTo.equals(that.assignedTo) : that.assignedTo != null) return false;
- if (author != null ? !author.equals(that.author) : that.author != null) return false;
- if (body != null ? !body.equals(that.body) : that.body != null) return false;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (partType != null ? !partType.equals(that.partType) : that.partType != null) return false;
- //noinspection RedundantIfStatement
- if (!type.equals(that.type)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (partType != null ? partType.hashCode() : 0);
- result = 31 * result + (body != null ? body.hashCode() : 0);
- result = 31 * result + (author != null ? author.hashCode() : 0);
- result = 31 * result + (assignedTo != null ? assignedTo.hashCode() : 0);
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
- result = 31 * result + (int) (NotifiedAt ^ (NotifiedAt >>> 32));
- return result;
- }
-
- @Override
- public String toString() {
- return "ConversationPart{" +
- "type='" + type + '\'' +
- ", id='" + id + '\'' +
- ", partType='" + partType + '\'' +
- ", body='" + body + '\'' +
- ", author=" + author +
- ", assignedTo=" + assignedTo +
- ", createdAt=" + createdAt +
- ", updatedAt=" + updatedAt +
- ", NotifiedAt=" + NotifiedAt +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/ConversationPartCollection.java b/intercom-java/src/main/java/io/intercom/api/ConversationPartCollection.java
deleted file mode 100644
index 0a67e617..00000000
--- a/intercom-java/src/main/java/io/intercom/api/ConversationPartCollection.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ConversationPartCollection extends TypedDataCollection {
-
- public ConversationPartCollection() {
- type = "conversation_part.list";
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("conversation_parts")
- public List getPage() {
- return super.getPage();
- }
-
- @Override
- public ConversationPartCollection nextPage() {
- return new ConversationPartCollection();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/CountItemDeserializer.java b/intercom-java/src/main/java/io/intercom/api/CountItemDeserializer.java
deleted file mode 100644
index e991d642..00000000
--- a/intercom-java/src/main/java/io/intercom/api/CountItemDeserializer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.TreeNode;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import java.io.IOException;
-import java.util.Map;
-
-class CountItemDeserializer extends StdDeserializer {
-
- private static final long serialVersionUID = 8226175715446656115L;
-
- public CountItemDeserializer() {
- super(Counts.CountItem.class);
- }
-
- @Override
- public Counts.CountItem deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
- final TreeNode treeNode = jp.getCodec().readTree(jp);
- final Map.Entry next = ((ObjectNode) treeNode).fields().next();
- return new Counts.CountItem(next.getKey(), next.getValue().asLong());
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/CountItemSerializer.java b/intercom-java/src/main/java/io/intercom/api/CountItemSerializer.java
deleted file mode 100644
index bdd581b0..00000000
--- a/intercom-java/src/main/java/io/intercom/api/CountItemSerializer.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-import java.io.IOException;
-
-class CountItemSerializer extends StdSerializer {
-
- public CountItemSerializer() {
- super(Counts.CountItem.class);
- }
-
- @Override
- public void serialize(Counts.CountItem value, JsonGenerator jgen, SerializerProvider provider)
- throws IOException {
- jgen.writeStartObject();
- jgen.writeNumberField(value.getName(), value.getValue());
- jgen.writeEndObject();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Counts.java b/intercom-java/src/main/java/io/intercom/api/Counts.java
deleted file mode 100644
index 170687de..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Counts.java
+++ /dev/null
@@ -1,340 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Counts {
-
- static Counts countQuery(Map query) {
- final URI build = UriBuilder.newBuilder()
- .path("counts")
- .query(query)
- .build();
- final HttpClient resource = new HttpClient(build);
- return resource.get(Counts.class);
- }
-
- public static Counts.Totals appTotals() throws InvalidException, AuthorizationException {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path("counts").build());
- return resource.get(Totals.class);
- }
-
-// public static Long userCount() throws InvalidException, AuthorizationException{
-// final HashMap params = Maps.newHashMap();
-// params.put("type", "user");
-// return countQuery(params).getUser().getUser();
-// }
-
- public static List userTags() throws InvalidException, AuthorizationException {
- final HashMap params = Maps.newHashMap();
- params.put("type", "user");
- params.put("count", "tag");
- return countQuery(params).getUser().getTags();
- }
-
- public static List userSegments() throws InvalidException, AuthorizationException {
- final HashMap params = Maps.newHashMap();
- params.put("type", "user");
- params.put("count", "segment");
- return countQuery(params).getUser().getSegments();
- }
-
- public static Counts.Conversation conversationTotals() throws InvalidException, AuthorizationException {
- final HashMap params = Maps.newHashMap();
- params.put("type", "conversation");
- return countQuery(params).getConversation();
- }
-
- public static Counts.Conversation conversationAdmins() throws InvalidException, AuthorizationException {
- final HashMap params = Maps.newHashMap();
- params.put("type", "conversation");
- params.put("count", "admin");
- return countQuery(params).getConversation();
- }
-
-// public static Long companyCount() throws InvalidException, AuthorizationException{
-// final HashMap params = Maps.newHashMap();
-// params.put("type", "company");
-// return countQuery(params).getCompany().getCompanies();
-// }
-
- public static List companySegments() throws InvalidException, AuthorizationException {
- final HashMap params = Maps.newHashMap();
- params.put("type", "company");
- params.put("count", "segment");
- return countQuery(params).getCompany().getSegments();
- }
-
- public static List companyTags() throws InvalidException, AuthorizationException {
- final HashMap params = Maps.newHashMap();
- params.put("type", "company");
- params.put("count", "tag");
- return countQuery(params).getCompany().getTags();
- }
-
- public static List companyUsers() throws InvalidException, AuthorizationException {
- final HashMap params = Maps.newHashMap();
- params.put("type", "company");
- params.put("count", "user");
- return countQuery(params).getCompany().getUsers();
- }
-
- @JsonIgnoreProperties(ignoreUnknown = true)
- @JsonInclude(JsonInclude.Include.NON_EMPTY)
- public static class Totals {
-
- @JsonProperty("company")
- private CountItem company;
-
- @JsonProperty("segment")
- private CountItem segment;
-
- @JsonProperty("tag")
- private CountItem tag;
-
- @JsonProperty("user")
- private CountItem user;
-
- public CountItem getCompany() {
- return company;
- }
-
- public CountItem getSegment() {
- return segment;
- }
-
- public CountItem getTag() {
- return tag;
- }
-
- public CountItem getUser() {
- return user;
- }
-
- @Override
- public String toString() {
- return "Totals{" +
- "company=" + company +
- ", segment=" + segment +
- ", tag=" + tag +
- ", user=" + user +
- '}';
- }
- }
-
- @JsonIgnoreProperties(ignoreUnknown = true)
- @JsonInclude(JsonInclude.Include.NON_EMPTY)
- public static class CountItem {
-
- private String name;
-
- private long value;
-
- public CountItem(String name, long value) {
- this.name = name;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public long getValue() {
- return value;
- }
-
- @Override
- public String toString() {
- return "CountItem{" +
- "name='" + name + '\'' +
- ", value=" + value +
- '}';
- }
- }
-
- @JsonIgnoreProperties(ignoreUnknown = true)
- @JsonInclude(JsonInclude.Include.NON_EMPTY)
- public static class Conversation {
-
- @JsonProperty("admin")
- List admins;
-
- @JsonProperty("assigned")
- private long assigned;
-
- @JsonProperty("closed")
- private long closed;
-
- @JsonProperty("open")
- private long open;
-
- @JsonProperty("unassigned")
- private long unassigned;
-
- Conversation() {
- }
-
- public List getAdmins() {
- return admins;
- }
-
- public long getAssigned() {
- return assigned;
- }
-
- public long getClosed() {
- return closed;
- }
-
- public long getOpen() {
- return open;
- }
-
- public long getUnassigned() {
- return unassigned;
- }
-
- @Override
- public String toString() {
- return "Conversation{" +
- "assigned=" + assigned +
- ", closed=" + closed +
- ", open=" + open +
- ", unassigned=" + unassigned +
- ", admins=" + admins +
- '}';
- }
- }
-
- @JsonIgnoreProperties(ignoreUnknown = true)
- @JsonInclude(JsonInclude.Include.NON_EMPTY)
- public static class User {
-
- @JsonProperty("user")
- private long user;
-
- @JsonProperty("tag")
- private List tags;
-
- @JsonProperty("segment")
- private List segments;
-
- User() {
- }
-
- public long getUser() {
- return user;
- }
-
- public List getTags() {
- return tags;
- }
-
- public List getSegments() {
- return segments;
- }
-
- @Override
- public String toString() {
- return "User{" +
- "user=" + user +
- ", tags=" + tags +
- ", segments=" + segments +
- '}';
- }
- }
-
- @JsonIgnoreProperties(ignoreUnknown = true)
- @JsonInclude(JsonInclude.Include.NON_EMPTY)
- public static class Company {
-
- @JsonProperty("company")
- private long companies;
-
- @JsonProperty("tag")
- private List tags;
-
- @JsonProperty("user")
- private List users;
-
- @JsonProperty("segment")
- private List segments;
-
- Company() {
- }
-
- public long getCompanies() {
- return companies;
- }
-
- public List getTags() {
- return tags;
- }
-
- public List getUsers() {
- return users;
- }
-
- public List getSegments() {
- return segments;
- }
-
- @Override
- public String toString() {
- return "Company{" +
- "companies=" + companies +
- ", tags=" + tags +
- ", users=" + users +
- ", segments=" + segments +
- '}';
- }
- }
-
- @JsonProperty("type")
- private String type = "count";
-
- @JsonProperty("company")
- private Counts.Company company;
-
- @JsonProperty("user")
- private Counts.User user;
-
- @JsonProperty("conversation")
- private Counts.Conversation conversation;
-
- public String getType() {
- return type;
- }
-
- public Company getCompany() {
- return company;
- }
-
- public User getUser() {
- return user;
- }
-
- public Conversation getConversation() {
- return conversation;
- }
-
- @Override
- public String toString() {
- return "Counts{" +
- "type='" + type + '\'' +
- ", company=" + company +
- ", user=" + user +
- ", conversation=" + conversation +
- '}';
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/CustomAttribute.java b/intercom-java/src/main/java/io/intercom/api/CustomAttribute.java
deleted file mode 100644
index 1415fa32..00000000
--- a/intercom-java/src/main/java/io/intercom/api/CustomAttribute.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package io.intercom.api;
-
-import com.google.common.collect.Lists;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-@SuppressWarnings("UnusedDeclaration")
-public class CustomAttribute {
-
- @SuppressWarnings("unchecked")
- private static final ArrayList extends Class extends Serializable>> CLASSES = Lists.newArrayList(String.class, Long.class, Float.class, Double.class, Boolean.class, Integer.class);
-
- public static StringAttribute newStringAttribute(String name, String value) {
- return new StringAttribute(name, value);
- }
-
- public static BooleanAttribute newBooleanAttribute(String name, boolean value) {
- return new BooleanAttribute(name, value);
- }
-
- public static DoubleAttribute newDoubleAttribute(String name, double value) {
- return new DoubleAttribute(name, value);
- }
-
- public static LongAttribute newLongAttribute(String name, long value) {
- return new LongAttribute(name, value);
- }
-
- public static IntegerAttribute newIntegerAttribute(String name, int value) {
- return new IntegerAttribute(name, value);
- }
-
- public static FloatAttribute newFloatAttribute(String name, float value) {
- return new FloatAttribute(name, value);
- }
-
- public static class StringAttribute extends CustomAttribute {
-
- private StringAttribute(String name, String value) {
- super(name, value, String.class);
- }
-
- private StringAttribute(String name, String value, Class clazz) {
- super(name, value, clazz);
- }
- }
-
- public static class BooleanAttribute extends CustomAttribute {
-
- private BooleanAttribute(String name, boolean value) {
- super(name, value, Boolean.class);
- }
-
- private BooleanAttribute(String name, boolean value, Class clazz) {
- super(name, value, clazz);
- }
- }
-
- public static class DoubleAttribute extends CustomAttribute {
-
- private DoubleAttribute(String name, double value, Class clazz) {
- super(name, value, clazz);
- }
-
- private DoubleAttribute(String name, double value) {
- super(name, value, Double.class);
- }
- }
-
- public static class FloatAttribute extends CustomAttribute {
-
- private FloatAttribute(String name, float value, Class clazz) {
- super(name, value, clazz);
- }
-
- private FloatAttribute(String name, float value) {
- super(name, value, Float.class);
- }
- }
-
- public static class IntegerAttribute extends CustomAttribute {
-
- private IntegerAttribute(String name, int value) {
- super(name, value, Integer.class);
- }
-
- private IntegerAttribute(String name, int value, Class clazz) {
- super(name, value, clazz);
- }
- }
-
- public static class LongAttribute extends CustomAttribute {
-
- public LongAttribute(String name, long value, Class clazz) {
- super(name, value, clazz);
- }
-
- public LongAttribute(String name, long value) {
- super(name, value, Long.class);
- }
-
- }
-
- private String name;
-
- private T value;
-
- private Class clazz;
-
- public CustomAttribute(String name, T value, Class clazz) {
- //noinspection SuspiciousMethodCalls
- if (!CLASSES.contains(clazz)) {
- throw new InvalidException(String.format("cannot accept class type [%s] for custom attribute", clazz.getName()));
- }
- this.name = name;
- this.value = value;
- this.clazz = clazz;
-
- }
-
- public Class getValueClass() {
- return clazz;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public T getValue() {
- return value;
- }
-
- public void setValue(T value) {
- this.value = value;
- }
-
- public C as(Class c) {
- //noinspection unchecked
- return (C) getValue();
- }
-
- public long longValue() {
- return as(Long.class);
- }
-
- public String textValue() {
- return as(String.class);
- }
-
- public boolean booleanValue() {
- return as(Boolean.class);
- }
-
- public float floatValue() {
- return as(Float.class);
- }
-
- public double doubleValue() {
- return as(Double.class);
- }
-
- public int integerValue() {
- return as(Integer.class);
- }
-
- @Override
- public int hashCode() {
- int result = name != null ? name.hashCode() : 0;
- result = 31 * result + (value != null ? value.hashCode() : 0);
- result = 31 * result + (clazz != null ? clazz.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- CustomAttribute that = (CustomAttribute) o;
-
- if (clazz != null ? !clazz.equals(that.clazz) : that.clazz != null) return false;
- if (name != null ? !name.equals(that.name) : that.name != null) return false;
- //noinspection RedundantIfStatement
- if (value != null ? !value.equals(that.value) : that.value != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return "CustomAttribute{" +
- "name='" + name + '\'' +
- ", value=" + value +
- ", clazz=" + clazz +
- '}';
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/CustomAttributeDeserializer.java b/intercom-java/src/main/java/io/intercom/api/CustomAttributeDeserializer.java
deleted file mode 100644
index 4756b257..00000000
--- a/intercom-java/src/main/java/io/intercom/api/CustomAttributeDeserializer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import com.fasterxml.jackson.databind.node.JsonNodeType;
-import com.fasterxml.jackson.databind.node.NumericNode;
-import com.fasterxml.jackson.databind.node.ValueNode;
-
-import java.io.IOException;
-
-class CustomAttributeDeserializer extends StdDeserializer {
-
- private static final long serialVersionUID = 5069924730975394938L;
-
- public CustomAttributeDeserializer() {
- super(CustomAttribute.class);
- }
-
- @Override
- public CustomAttribute deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
- CustomAttribute cda = null;
- final String currentName = jp.getParsingContext().getCurrentName();
- final ObjectMapper mapper = (ObjectMapper) jp.getCodec();
- final ValueNode vNode = mapper.readTree(jp);
- if (vNode.asToken().isScalarValue()) {
- if (vNode.getNodeType() == JsonNodeType.BOOLEAN) {
- cda = new CustomAttribute(currentName, vNode.asBoolean(), Boolean.class);
- } else if (vNode.getNodeType() == JsonNodeType.STRING) {
- cda = new CustomAttribute(currentName, vNode.asText(), String.class);
- } else if (vNode.getNodeType() == JsonNodeType.NUMBER) {
- final NumericNode nNode = (NumericNode) vNode;
- if (currentName.endsWith("_at")) {
- cda = new CustomAttribute(currentName, vNode.longValue(), Long.class);
- } else if (nNode.isInt()) {
- cda = new CustomAttribute(currentName, vNode.intValue(), Integer.class);
- } else if (nNode.isFloat()) {
- cda = new CustomAttribute(currentName, vNode.floatValue(), Float.class);
- } else if (nNode.isDouble()) {
- cda = new CustomAttribute(currentName, vNode.doubleValue(), Double.class);
- } else if (nNode.isLong()) {
- cda = new CustomAttribute(currentName, vNode.longValue(), Long.class);
- } else {
- cda = new CustomAttribute(currentName, vNode.asText(), String.class);
- }
- } else {
- cda = new CustomAttribute(currentName, vNode.asText(), String.class);
- }
- }
- return cda;
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/CustomAttributeSerializer.java b/intercom-java/src/main/java/io/intercom/api/CustomAttributeSerializer.java
deleted file mode 100644
index 07c2cf08..00000000
--- a/intercom-java/src/main/java/io/intercom/api/CustomAttributeSerializer.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-import java.io.IOException;
-
-class CustomAttributeSerializer extends StdSerializer {
-
- public CustomAttributeSerializer() {
- super(CustomAttribute.class);
- }
-
- @Override
- public void serialize(CustomAttribute value, JsonGenerator jgen, SerializerProvider provider)
- throws IOException {
- // the field name has already been written
- jgen.writeObject(value.getValue());
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/DataResource.java b/intercom-java/src/main/java/io/intercom/api/DataResource.java
deleted file mode 100644
index 71f69eae..00000000
--- a/intercom-java/src/main/java/io/intercom/api/DataResource.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.intercom.api;
-
-import java.util.Map;
-
-abstract class DataResource {
-
- @SuppressWarnings("SameParameterValue")
- public static T find(String id, String collectionPath, Class c) {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path(collectionPath).path(id).build());
- return resource.get(c);
- }
-
- public static T find(Map params, String collectionPath, Class c) {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path(collectionPath).query(params).build());
- return resource.get(c);
- }
-
- public static R create(T entity, String collectionPath, Class response) {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path(collectionPath).build());
- return resource.post(response, entity);
- }
-
- public static R update(T entity, String collectionPath, Class response) {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path(collectionPath).build());
- return resource.post(response, entity);
- }
-
- @SuppressWarnings("SameParameterValue")
- public static R update(T entity, String collectionPath, String id, Class response) {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path(collectionPath).path(id).build());
- return resource.post(response, entity);
- }
-
- public static T delete(String id, String collectionPath, Class c) {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path(collectionPath).path(id).build());
- return resource.delete(c);
- }
-
- public static C list(Map params, String collectionPath, Class c) {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path(collectionPath).query(params).build());
- return resource.get(c);
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Error.java b/intercom-java/src/main/java/io/intercom/api/Error.java
deleted file mode 100644
index 10beabd2..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Error.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class Error extends TypedData {
-
- @SuppressWarnings("FieldCanBeLocal")
- @JsonProperty("type")
- private final String type = "error";
-
- @JsonProperty("code")
- private String code;
-
- @JsonProperty("message")
- private String message;
-
- public Error() {
- }
-
- public Error(String code, String message) {
- this.code = code;
- this.message = message;
- }
-
- public String getType() {
- return type;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public int hashCode() {
- int result = code != null ? code.hashCode() : 0;
- result = 31 * result + (message != null ? message.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Error error = (Error) o;
-
- if (code != null ? !code.equals(error.code) : error.code != null) return false;
- //noinspection RedundantIfStatement
- if (message != null ? !message.equals(error.message) : error.message != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return getType() + "{" +
- "code='" + code + '\'' +
- ", message='" + message + '\'' +
- "} " + super.toString();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/ErrorCollection.java b/intercom-java/src/main/java/io/intercom/api/ErrorCollection.java
deleted file mode 100644
index d9720516..00000000
--- a/intercom-java/src/main/java/io/intercom/api/ErrorCollection.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.Preconditions;
-
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public final class ErrorCollection {
-
- @JsonProperty("errors")
- private List errors;
-
- // for jackson
- ErrorCollection() {
- }
-
- public ErrorCollection(List errors) {
- Preconditions.checkNotNull(errors, "cannot create an error collection with a null error list");
- Preconditions.checkArgument(errors.size() > 0, "cannot create an error collection with an empty error list");
- this.errors = errors;
- }
-
- public List getErrors() {
- return errors;
- }
-
- public String getType() {
- return "error.list";
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Event.java b/intercom-java/src/main/java/io/intercom/api/Event.java
deleted file mode 100644
index f42fe875..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Event.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_DEFAULT)
-public class Event extends TypedData {
-
- public static void create(Event event) throws InvalidException, AuthorizationException {
-
- validateCreateEvent(event);
-
- if (event.getCreatedAt() == 0L) {
- event.setCreatedAt(System.currentTimeMillis() / 1000);
- }
- DataResource.create(event, "events", Void.class);
- }
-
- private static final ErrorCollection INVALID_NAME = new ErrorCollection(
- Lists.newArrayList(
- new Error("invalid", "an event must supply an event name")));
-
- private static final ErrorCollection INVALID_USER = new ErrorCollection(
- Lists.newArrayList(
- new Error("invalid", "an event must supply either an email or a user id")));
-
- @VisibleForTesting
- static void validateCreateEvent(Event event) {
- if (Strings.isNullOrEmpty(event.getEventName())) {
- throw new InvalidException(INVALID_NAME);
- }
-
- if (Strings.isNullOrEmpty(event.getUserID())
- && Strings.isNullOrEmpty(event.getEmail())) {
- throw new InvalidException(INVALID_USER);
- }
- }
-
- @SuppressWarnings("FieldCanBeLocal")
- @JsonProperty("type")
- private final String type = "event";
-
- @JsonProperty("event_name")
- private String eventName;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("email")
- private String email;
-
- @JsonProperty("user_id")
- private String userID;
-
- @JsonProperty("metadata")
- private Map metadata = Maps.newHashMap();
-
- public Event() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getEventName() {
- return eventName;
- }
-
- public Event setEventName(String eventName) {
- this.eventName = eventName;
- return this;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- @SuppressWarnings("UnusedReturnValue")
- public Event setCreatedAt(long createdAt) {
- this.createdAt = createdAt;
- return this;
- }
-
- public String getEmail() {
- return email;
- }
-
- public Event setEmail(String email) {
- this.email = email;
- return this;
- }
-
- public String getUserID() {
- return userID;
- }
-
- public Event setUserID(String userID) {
- this.userID = userID;
- return this;
- }
-
- public Event putMetadata(String name, String value) {
- metadata.put(name, value);
- return this;
- }
-
- public Event putMetadata(String name, boolean value) {
- metadata.put(name, value);
- return this;
- }
-
- public Event putMetadata(String name, int value) {
- metadata.put(name, value);
- return this;
- }
-
- public Event putMetadata(String name, double value) {
- metadata.put(name, value);
- return this;
- }
-
- public Event putMetadata(String name, long value) {
- metadata.put(name, value);
- return this;
- }
-
- public Event putMetadata(String name, float value) {
- metadata.put(name, value);
- return this;
- }
-
- public Map getMetadata() {
- return metadata;
- }
-
- public Event setMetadata(Map metadata) {
- this.metadata = metadata;
- return this;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Event event = (Event) o;
-
- if (createdAt != event.createdAt) return false;
- if (email != null ? !email.equals(event.email) : event.email != null) return false;
- if (eventName != null ? !eventName.equals(event.eventName) : event.eventName != null) return false;
- if (metadata != null ? !metadata.equals(event.metadata) : event.metadata != null) return false;
- if (!type.equals(event.type)) return false;
- //noinspection RedundantIfStatement
- if (userID != null ? !userID.equals(event.userID) : event.userID != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (eventName != null ? eventName.hashCode() : 0);
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (email != null ? email.hashCode() : 0);
- result = 31 * result + (userID != null ? userID.hashCode() : 0);
- result = 31 * result + (metadata != null ? metadata.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "Event{" +
- "type='" + type + '\'' +
- ", eventName='" + eventName + '\'' +
- ", createdAt=" + createdAt +
- ", email='" + email + '\'' +
- ", userID='" + userID + '\'' +
- ", metadata=" + metadata +
- "} " + super.toString();
- }
-}
-
-
diff --git a/intercom-java/src/main/java/io/intercom/api/HttpClient.java b/intercom-java/src/main/java/io/intercom/api/HttpClient.java
deleted file mode 100644
index b45af129..00000000
--- a/intercom-java/src/main/java/io/intercom/api/HttpClient.java
+++ /dev/null
@@ -1,256 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.io.CharStreams;
-import org.apache.commons.codec.binary.Base64;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ThreadLocalRandom;
-
-class HttpClient {
-
- private static final Logger logger = LoggerFactory.getLogger("intercom-java");
-
- private static final String CLIENT_AGENT_DETAILS = clientAgentDetails();
-
- private static final String USER_AGENT = Intercom.USER_AGENT;
-
- private static final String UTF_8 = "UTF-8";
-
- private static final String APPLICATION_JSON = "application/json";
-
- private static String clientAgentDetails() {
- final HashMap map = Maps.newHashMap();
- final ArrayList propKeys = Lists.newArrayList(
- "os.arch", "os.name", "os.version",
- "user.language", "user.timezone",
- "java.class.version", "java.runtime.version", "java.version",
- "java.vm.name", "java.vm.vendor", "java.vm.version");
- for (String propKey : propKeys) {
- map.put(propKey, System.getProperty(propKey));
- }
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try {
- MapperSupport.objectMapper().disable(SerializationFeature.INDENT_OUTPUT).writeValue(baos, map);
- } catch (IOException e) {
- logger.warn(String.format("could not serialize client agent details [%s]", e.getMessage()), e);
- }
- return baos.toString();
- }
-
- private final ObjectMapper objectMapper;
-
- private final URI uri;
-
- private final Map headers;
-
- private final String apiKey = Intercom.getApiKey();
-
- private final HttpConnectorSupplier connection = Intercom.getHttpConnectorSupplier();
-
- public HttpClient(URI uri) {
- this(uri, Maps.newHashMap());
- }
-
- private HttpClient(URI uri, Map headers) {
- this.uri = uri;
- this.headers = headers;
- this.objectMapper = MapperSupport.objectMapper();
- }
-
- public T get(Class reqres) throws IntercomException {
- HttpURLConnection conn = null;
- try {
- conn = initializeConnection(uri, "GET");
- return runRequest(uri, reqres, conn);
- } catch (IOException e) {
- return throwLocalException(e);
- } finally {
- IOUtils.disconnectQuietly(conn);
- }
- }
-
- public T post(Class reqres, E entity) {
- headers.put("Content-Type", APPLICATION_JSON);
- HttpURLConnection conn = null;
- try {
- conn = initializeConnection(uri, "POST");
- prepareRequestEntity(entity, conn);
- return runRequest(uri, reqres, conn);
- } catch (IOException e) {
- return throwLocalException(e);
- } finally {
- IOUtils.disconnectQuietly(conn);
- }
- }
-
- public T delete(Class reqres) {
- HttpURLConnection conn = null;
- try {
- conn = initializeConnection(uri, "DELETE");
- return runRequest(uri, reqres, conn);
- } catch (IOException e) {
- return throwLocalException(e);
- } finally {
- IOUtils.disconnectQuietly(conn);
- }
- }
-
- // trick java with a dummy return
- private T throwLocalException(IOException e) {
- throw new IntercomException(String.format("Local exception calling [%s]. Check connectivity and settings. [%s]", uri.toASCIIString(), e.getMessage()), e);
- }
-
- private void prepareRequestEntity(Object entity, HttpURLConnection conn) throws IOException {
- conn.setDoOutput(true);
- OutputStream stream = null;
- try {
- stream = conn.getOutputStream();
- if (logger.isDebugEnabled()) {
- logger.info(String.format("api server request --\n%s\n-- ", objectMapper.writeValueAsString(entity)));
- }
- objectMapper.writeValue(stream, entity);
- } finally {
- IOUtils.closeQuietly(stream);
- }
- }
-
- private HttpURLConnection initializeConnection(URI uri, String method) throws IOException {
- HttpURLConnection conn = connection.connect(uri);
- conn.setRequestMethod(method);
- conn = prepareConnection(conn);
- conn = applyHeaders(conn);
- return conn;
- }
-
- private T runRequest(URI uri, Class response, HttpURLConnection conn) throws IOException {
- conn.connect();
- final int responseCode = conn.getResponseCode();
- if (responseCode >= 200 && responseCode < 300) {
- return handleSuccess(response, conn, responseCode);
- } else {
- // errors are redirects for now
- return handleError(uri, conn, responseCode);
- }
- }
-
- private T handleError(URI uri, HttpURLConnection conn, int responseCode) throws IOException {
- ErrorCollection errors;
- try {
- errors = objectMapper.readValue(conn.getErrorStream(), ErrorCollection.class);
- } catch (IOException e) {
- errors = createUnprocessableErrorResponse(e);
- }
- if (logger.isDebugEnabled()) {
- logger.debug("error json follows --\n{}\n-- ", objectMapper.writeValueAsString(errors));
- }
- return throwException(responseCode, errors);
- }
-
- private T handleSuccess(Class response, HttpURLConnection conn, int responseCode) throws IOException {
- if (responseCode == 202 || responseCode == 204 || Void.class.equals(response)) {
- return null;
- } else {
- return readEntity(conn, responseCode, response);
- }
- }
-
- private T readEntity(HttpURLConnection conn, int responseCode, Class entityType) throws IOException {
- final InputStream entityStream = conn.getInputStream();
- try {
- if (logger.isDebugEnabled()) {
- final String text = CharStreams.toString(new InputStreamReader(entityStream));
- logger.debug("api server response status[{}] --\n{}\n-- ", responseCode, text);
- return objectMapper.readValue(text, entityType);
- } else {
- return objectMapper.readValue(entityStream, entityType);
- }
- } finally {
- IOUtils.closeQuietly(entityStream);
- }
- }
-
- private T throwException(int responseCode, ErrorCollection errors) {
- // bind some well known response codes to exceptions
- if (responseCode == 403 || responseCode == 401) {
- throw new AuthorizationException(errors);
- } else if (responseCode == 429) {
- throw new RateLimitException(errors);
- } else if (responseCode == 404) {
- throw new NotFoundException(errors);
- } else if (responseCode == 422) {
- throw new InvalidException(errors);
- } else if (responseCode == 400 || responseCode == 405 || responseCode == 406) {
- throw new ClientException(errors);
- } else if (responseCode == 500 || responseCode == 503) {
- throw new ServerException(errors);
- } else {
- throw new IntercomException(errors);
- }
- }
-
- private HttpURLConnection applyHeaders(HttpURLConnection conn) {
- for (Map.Entry entry : createHeaders().entrySet()) {
- conn.setRequestProperty(entry.getKey(), entry.getValue());
- }
- for (Map.Entry entry : createAuthorizationHeaders().entrySet()) {
- conn.setRequestProperty(entry.getKey(), entry.getValue());
- }
- return conn;
- }
-
- // todo: expose this config
- private HttpURLConnection prepareConnection(HttpURLConnection conn) {
- conn.setConnectTimeout(Intercom.getConnectionTimeout());
- conn.setReadTimeout(Intercom.getRequestTimeout());
- conn.setUseCaches(Intercom.isRequestUsingCaches());
- return conn;
- }
-
- private Map createAuthorizationHeaders() {
- if (Intercom.getAuthScheme().equals(Intercom.AUTH_BEARER)) {
- headers.put("Authorization", "Bearer " + apiKey);
- } else if (Intercom.getAuthScheme().equals(Intercom.AUTH_BASIC)) {
- final String authString = Intercom.getAppID() + ":" + Intercom.getApiKey();
- headers.put("Authorization", "Basic " + Base64.encodeBase64String(authString.getBytes()));
- }
- return headers;
- }
-
- private Map createHeaders() {
- headers.put("User-Agent", USER_AGENT);
- headers.put("X-Client-Platform-Details", CLIENT_AGENT_DETAILS);
- headers.put("Accept-Charset", UTF_8);
- headers.put("Accept", APPLICATION_JSON);
- return headers;
- }
-
- private ErrorCollection createUnprocessableErrorResponse(IOException e) {
- ErrorCollection errors;
- final long grepCode = getGrepCode();
- final String msg = String.format("could not parse error response: [%s]", e.getLocalizedMessage());
- logger.error(String.format("[%016x] %s", grepCode, msg), e);
- Error err = new Error("unprocessable_entity", String.format("%s logged with code [%016x]", msg, grepCode));
- errors = new ErrorCollection(Lists.newArrayList(err));
- return errors;
- }
-
- private long getGrepCode() {
- return ThreadLocalRandom.current().nextLong();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/HttpConnectorSupplier.java b/intercom-java/src/main/java/io/intercom/api/HttpConnectorSupplier.java
deleted file mode 100644
index de02df36..00000000
--- a/intercom-java/src/main/java/io/intercom/api/HttpConnectorSupplier.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package io.intercom.api;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URI;
-
-public interface HttpConnectorSupplier {
-
- HttpURLConnection connect(URI uri) throws IOException;
-
- HttpConnectorSupplier defaultSupplier = new HttpConnectorSupplier() {
- public HttpURLConnection connect(URI uri) throws IOException {
- return (HttpURLConnection) uri.toURL().openConnection();
- }
- };
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/IOUtils.java b/intercom-java/src/main/java/io/intercom/api/IOUtils.java
deleted file mode 100644
index b6f5966d..00000000
--- a/intercom-java/src/main/java/io/intercom/api/IOUtils.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.intercom.api;
-
-import org.slf4j.LoggerFactory;
-
-import java.io.Closeable;
-import java.net.HttpURLConnection;
-
-class IOUtils {
-
- private static final org.slf4j.Logger logger = LoggerFactory.getLogger("intercom-java");
-
- /**
- * Close a HttpURLConnection, ignores checked Exceptions and nulls,
- * but rethrows RuntimeExceptions.
- *
- * @param connection the connection to disconnect
- */
- public static void disconnectQuietly(HttpURLConnection connection) {
- if (connection != null) {
- try {
- connection.disconnect();
- } catch (RuntimeException rethrow) {
- throw rethrow;
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- }
- }
-
- /**
- * Close a stream, ignores checked Exceptions and nulls,
- * but rethrows RuntimeExceptions.
- *
- * @param stream the object to close
- */
- public static void closeQuietly(Closeable stream) {
- if (stream != null) {
- try {
- stream.close();
- } catch (RuntimeException rethrow) {
- throw rethrow;
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- }
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Intercom.java b/intercom-java/src/main/java/io/intercom/api/Intercom.java
deleted file mode 100644
index 737a1d39..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Intercom.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package io.intercom.api;
-
-import java.net.URI;
-
-public class Intercom {
-
- private static final URI API_BASE_URI = URI.create("https://api.intercom.io/");
-
- private static volatile URI apiBaseURI = API_BASE_URI;
-
- static final String AUTH_BASIC = "Basic";
-
- private static final String AUTH_SCHEME = AUTH_BASIC;
-
- static final String AUTH_BEARER = "Bearer";
-
- private static final String VERSION = "1.0.3";
-
- public static final String USER_AGENT = "intercom-java/" + Intercom.VERSION;
-
- private static volatile String apiKey;
-
- private static volatile String appID;
-
- private static volatile int connectionTimeout = 3 * 1000;
-
- private static volatile int requestTimeout = 60 * 1000;
-
- private static volatile boolean requestUsingCaches = false;
-
- private static volatile HttpConnectorSupplier httpConnectorSupplier = HttpConnectorSupplier.defaultSupplier;
-
- public static int getConnectionTimeout() {
- return connectionTimeout;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public static void setConnectionTimeout(int connectionTimeout) {
- Intercom.connectionTimeout = connectionTimeout;
- }
-
- public static int getRequestTimeout() {
- return requestTimeout;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public static void setRequestTimeout(int requestTimeout) {
- Intercom.requestTimeout = requestTimeout;
- }
-
- public static boolean isRequestUsingCaches() {
- return requestUsingCaches;
- }
-
- public static void setRequestUsingCaches(boolean requestUsingCaches) {
- Intercom.requestUsingCaches = requestUsingCaches;
- }
-
- public static HttpConnectorSupplier getHttpConnectorSupplier() {
- return httpConnectorSupplier;
- }
-
- public static void setHttpConnectorSupplier(HttpConnectorSupplier supplier) {
- Intercom.httpConnectorSupplier = supplier;
- }
-
- public static String getAppID() {
- return appID;
- }
-
- public static void setAppID(String appID) {
- Intercom.appID = appID;
- }
-
- public static String getApiKey() {
- return Intercom.apiKey;
- }
-
- public static void setApiKey(String apiKey) {
- Intercom.apiKey = apiKey;
- }
-
- public static URI getApiBaseURI() {
- return Intercom.apiBaseURI;
- }
-
- public static void setApiBaseURI(URI apiBaseURI) {
- Intercom.apiBaseURI = apiBaseURI;
- }
-
- static String getAuthScheme() {
- return AUTH_SCHEME;
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/IntercomException.java b/intercom-java/src/main/java/io/intercom/api/IntercomException.java
deleted file mode 100644
index b32441fc..00000000
--- a/intercom-java/src/main/java/io/intercom/api/IntercomException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.intercom.api;
-
-public class IntercomException extends RuntimeException {
-
- private static final long serialVersionUID = -2723350106062183796L;
-
- private ErrorCollection errorCollection;
-
- @SuppressWarnings("WeakerAccess")
- public IntercomException(String message) {
- super(message);
- }
-
- public IntercomException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public IntercomException(ErrorCollection errorCollection) {
- this(getMessage(errorCollection));
- this.errorCollection = errorCollection;
- }
-
- public static String getMessage(ErrorCollection errorCollection) {
- String message = "Could not read error message from server";
- if(errorCollection!=null
- && errorCollection.getErrors() != null
- && errorCollection.getErrors().size() > 0
- && errorCollection.getErrors().get(0) != null
- && errorCollection.getErrors().get(0).getMessage() != null){
- message = errorCollection.getErrors().get(0).getMessage();
- }
- return message;
- }
-
- @SuppressWarnings("WeakerAccess")
- public IntercomException(ErrorCollection errorCollection, Throwable cause) {
- this(getMessage(errorCollection), cause);
- this.errorCollection = errorCollection;
- }
-
- public ErrorCollection getErrorCollection() {
- return errorCollection;
- }
-
- public Error getFirstError() {
- return errorCollection.getErrors().get(0);
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/InvalidException.java b/intercom-java/src/main/java/io/intercom/api/InvalidException.java
deleted file mode 100644
index 6a4381bd..00000000
--- a/intercom-java/src/main/java/io/intercom/api/InvalidException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.intercom.api;
-
-public class InvalidException extends IntercomException {
-
- private static final long serialVersionUID = -2111295679006526646L;
-
- public InvalidException(String message) {
- super(message);
- }
-
- public InvalidException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidException(ErrorCollection errorCollection) {
- super(errorCollection);
- }
-
- public InvalidException(ErrorCollection errorCollection, Throwable cause) {
- super(errorCollection, cause);
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/LocationData.java b/intercom-java/src/main/java/io/intercom/api/LocationData.java
deleted file mode 100644
index 48cb7806..00000000
--- a/intercom-java/src/main/java/io/intercom/api/LocationData.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class LocationData extends TypedData {
-
- @JsonProperty("type")
- private final String type = "location_data";
-
- @JsonProperty("city_name")
- private String city_Name;
-
- @JsonProperty("continent_code")
- private String continentCode;
-
- @JsonProperty("country_code")
- private String countryCode;
-
- @JsonProperty("country_name")
- private String countryName;
-
- @JsonProperty("latitude")
- private float latitude;
-
- @JsonProperty("longitude")
- private float longitude;
-
- @JsonProperty("postal_code")
- private String postalCode;
-
- @JsonProperty("region_name")
- private String regionName;
-
- @JsonProperty("timezone")
- private String timezone;
-
- public LocationData() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getCity_Name() {
- return city_Name;
- }
-
- public String getContinentCode() {
- return continentCode;
- }
-
- public String getCountryCode() {
- return countryCode;
- }
-
- public String getCountryName() {
- return countryName;
- }
-
- public float getLatitude() {
- return latitude;
- }
-
- public float getLongitude() {
- return longitude;
- }
-
- public String getPostalCode() {
- return postalCode;
- }
-
- public String getRegionName() {
- return regionName;
- }
-
- public String getTimezone() {
- return timezone;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- LocationData that = (LocationData) o;
-
- if (Float.compare(that.latitude, latitude) != 0) return false;
- if (Float.compare(that.longitude, longitude) != 0) return false;
- if (city_Name != null ? !city_Name.equals(that.city_Name) : that.city_Name != null) return false;
- if (continentCode != null ? !continentCode.equals(that.continentCode) : that.continentCode != null)
- return false;
- if (countryCode != null ? !countryCode.equals(that.countryCode) : that.countryCode != null) return false;
- if (countryName != null ? !countryName.equals(that.countryName) : that.countryName != null) return false;
- if (postalCode != null ? !postalCode.equals(that.postalCode) : that.postalCode != null) return false;
- if (regionName != null ? !regionName.equals(that.regionName) : that.regionName != null) return false;
- if (timezone != null ? !timezone.equals(that.timezone) : that.timezone != null) return false;
- //noinspection RedundantIfStatement
- if (!type.equals(that.type)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (city_Name != null ? city_Name.hashCode() : 0);
- result = 31 * result + (continentCode != null ? continentCode.hashCode() : 0);
- result = 31 * result + (countryCode != null ? countryCode.hashCode() : 0);
- result = 31 * result + (countryName != null ? countryName.hashCode() : 0);
- result = 31 * result + (latitude != +0.0f ? Float.floatToIntBits(latitude) : 0);
- result = 31 * result + (longitude != +0.0f ? Float.floatToIntBits(longitude) : 0);
- result = 31 * result + (postalCode != null ? postalCode.hashCode() : 0);
- result = 31 * result + (regionName != null ? regionName.hashCode() : 0);
- result = 31 * result + (timezone != null ? timezone.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "LocationData{" +
- "type='" + type + '\'' +
- ", city_Name='" + city_Name + '\'' +
- ", continentCode='" + continentCode + '\'' +
- ", countryCode='" + countryCode + '\'' +
- ", countryName='" + countryName + '\'' +
- ", latitude=" + latitude +
- ", longitude=" + longitude +
- ", postalCode='" + postalCode + '\'' +
- ", regionName='" + regionName + '\'' +
- ", timezone='" + timezone + '\'' +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/MapperSupport.java b/intercom-java/src/main/java/io/intercom/api/MapperSupport.java
deleted file mode 100644
index b239698d..00000000
--- a/intercom-java/src/main/java/io/intercom/api/MapperSupport.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.core.Version;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-
-public class MapperSupport {
-
- public static ObjectMapper objectMapper() {
- final ObjectMapper om = Holder.INSTANCE;
- configure(om);
- return om;
- }
-
- private static void configure(ObjectMapper objectMapper) {
- objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
- objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
- objectMapper.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false);
- objectMapper.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false);
- objectMapper.registerModule(customAttributeModule());
- }
-
- private static SimpleModule customAttributeModule() {
- final SimpleModule customAttributeModule = new SimpleModule(
- "IntercomClientModule",
- new Version(1, 0, 0, null, "", "")
- );
- customAttributeModule.addDeserializer(CustomAttribute.class, new CustomAttributeDeserializer());
- customAttributeModule.addSerializer(CustomAttribute.class, new CustomAttributeSerializer());
- customAttributeModule.addDeserializer(Subscription.Topic.class, new TopicDeserializer());
- customAttributeModule.addSerializer(Subscription.Topic.class, new TopicSerializer());
- customAttributeModule.addSerializer(Counts.CountItem.class, new CountItemSerializer());
- customAttributeModule.addDeserializer(Counts.CountItem.class, new CountItemDeserializer());
- return customAttributeModule;
- }
-
- private static class Holder {
- private static final ObjectMapper INSTANCE = new ObjectMapper();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/NotFoundException.java b/intercom-java/src/main/java/io/intercom/api/NotFoundException.java
deleted file mode 100644
index e0806ad9..00000000
--- a/intercom-java/src/main/java/io/intercom/api/NotFoundException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.intercom.api;
-
-public class NotFoundException extends IntercomException {
-
- private static final long serialVersionUID = 2917082281352001861L;
-
- public NotFoundException(String message) {
- super(message);
- }
-
- public NotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public NotFoundException(ErrorCollection errorCollection) {
- super(errorCollection);
- }
-
- public NotFoundException(ErrorCollection errorCollection, Throwable cause) {
- super(errorCollection, cause);
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Note.java b/intercom-java/src/main/java/io/intercom/api/Note.java
deleted file mode 100644
index fa7b8b3e..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Note.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Note extends TypedData {
-
- private static final HashMap SENTINEL = Maps.newHashMap();
-
- public static Note find(String id) throws InvalidException, AuthorizationException {
- return DataResource.find(id, "notes", Note.class);
- }
-
- public static Note create(Note note) throws InvalidException, AuthorizationException {
- return DataResource.create(note, "notes", Note.class);
- }
-
- public static NoteCollection list(Map params) throws InvalidException, AuthorizationException {
- if ((!params.containsKey("email")) && (!params.containsKey("id")) && (!params.containsKey("user_id")) && (!params.containsKey("intercom_user_id"))) {
- throw new InvalidException("a notes query must include an email, user_id or intercom_user_id parameter");
- }
- return DataResource.list(params, "notes", NoteCollection.class);
- }
-
- @JsonProperty("type")
- private final String type = "note";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("body")
- private String body;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("user")
- private User user;
-
- @JsonProperty("author")
- private Author author;
-
- public Note() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getId() {
- return id;
- }
-
- public String getBody() {
- return body;
- }
-
- public Note setBody(String body) {
- this.body = body;
- return this;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public User getUser() {
- return user;
- }
-
- public Note setUser(User user) {
- this.user = user;
- return this;
- }
-
- public Author getAuthor() {
- return author;
- }
-
- public Note setAuthor(Author author) {
- this.author = author;
- return this;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Note note = (Note) o;
-
- if (createdAt != note.createdAt) return false;
- if (author != null ? !author.equals(note.author) : note.author != null) return false;
- if (body != null ? !body.equals(note.body) : note.body != null) return false;
- if (id != null ? !id.equals(note.id) : note.id != null) return false;
- if (!type.equals(note.type)) return false;
- //noinspection RedundantIfStatement
- if (user != null ? !user.equals(note.user) : note.user != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (body != null ? body.hashCode() : 0);
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (user != null ? user.hashCode() : 0);
- result = 31 * result + (author != null ? author.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "Note{" +
- "id='" + id + '\'' +
- ", body='" + body + '\'' +
- ", createdAt=" + createdAt +
- ", user=" + user +
- ", author=" + author +
- "} " + super.toString();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/NoteCollection.java b/intercom-java/src/main/java/io/intercom/api/NoteCollection.java
deleted file mode 100644
index 8a389088..00000000
--- a/intercom-java/src/main/java/io/intercom/api/NoteCollection.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Iterator;
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class NoteCollection extends TypedDataCollection implements Iterator {
-
- protected TypedDataCollectionIterator iterator;
-
- public NoteCollection() {
- iterator = new TypedDataCollectionIterator(this);
- }
-
- @Override
- public NoteCollection nextPage() {
- return fetchNextPage(NoteCollection.class);
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("notes")
- @Override
- public List getPage() {
- return super.getPage();
- }
-
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public Note next() {
- return iterator.next();
- }
-
- public void remove() {
- iterator.remove();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Notification.java b/intercom-java/src/main/java/io/intercom/api/Notification.java
deleted file mode 100644
index 04f9d424..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Notification.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties({"intercom"})
-public class Notification extends TypedData {
-
- public static Notification readJSON(String json) throws InvalidException {
- try {
- return MapperSupport.objectMapper().readValue(json, Notification.class);
- } catch (IOException e) {
- throw new InvalidException("could not parse json string [" + e.getMessage() + "]", e);
- }
- }
-
- public static Notification readJSON(InputStream json) throws InvalidException {
- try {
- return MapperSupport.objectMapper().readValue(json, Notification.class);
- } catch (IOException e) {
- throw new InvalidException("could not parse json stream [" + e.getMessage() + "]", e);
- }
- }
-
- @JsonProperty("type")
- private final String type = "notification_event";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("topic")
- private String topic;
-
- @JsonProperty("app_id")
- private String appID;
-
- @JsonProperty("data")
- private NotificationData data;
-
- @JsonProperty("delivery_status")
- private String deliveryStatus;
-
- @JsonProperty("delivery_attempts")
- private int deliveryAttempts;
-
- @JsonProperty("delivered_at")
- private long deliveredAt;
-
- @JsonProperty("first_sent_at")
- private long firstSentAt;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty
- private Map links = Maps.newHashMap();
-
- @JsonProperty("self")
- private URI self;
-
- public Notification() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getTopic() {
- return topic;
- }
-
- public void setTopic(String topic) {
- this.topic = topic;
- }
-
- public String getAppID() {
- return appID;
- }
-
- public void setAppID(String appID) {
- this.appID = appID;
- }
-
- public NotificationData getData() {
- return data;
- }
-
- public void setData(NotificationData data) {
- this.data = data;
- }
-
- public String getDeliveryStatus() {
- return deliveryStatus;
- }
-
- public void setDeliveryStatus(String deliveryStatus) {
- this.deliveryStatus = deliveryStatus;
- }
-
- public int getDeliveryAttempts() {
- return deliveryAttempts;
- }
-
- public void setDeliveryAttempts(int deliveryAttempts) {
- this.deliveryAttempts = deliveryAttempts;
- }
-
- public long getDeliveredAt() {
- return deliveredAt;
- }
-
- public void setDeliveredAt(long deliveredAt) {
- this.deliveredAt = deliveredAt;
- }
-
- public long getFirstSentAt() {
- return firstSentAt;
- }
-
- public void setFirstSentAt(long firstSentAt) {
- this.firstSentAt = firstSentAt;
- }
-
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public Map getLinks() {
- return links;
- }
-
- public void setLinks(Map links) {
- this.links = links;
- }
-
- public URI getSelf() {
- return self;
- }
-
- public void setSelf(URI self) {
- this.self = self;
- }
-
- @Override
- public int hashCode() {
- int result = id != null ? id.hashCode() : 0;
- result = 31 * result + (topic != null ? topic.hashCode() : 0);
- result = 31 * result + (appID != null ? appID.hashCode() : 0);
- result = 31 * result + (data != null ? data.hashCode() : 0);
- result = 31 * result + (deliveryStatus != null ? deliveryStatus.hashCode() : 0);
- result = 31 * result + deliveryAttempts;
- result = 31 * result + (int) (deliveredAt ^ (deliveredAt >>> 32));
- result = 31 * result + (int) (firstSentAt ^ (firstSentAt >>> 32));
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (links != null ? links.hashCode() : 0);
- result = 31 * result + (self != null ? self.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Notification that = (Notification) o;
-
- if (createdAt != that.createdAt) return false;
- if (deliveredAt != that.deliveredAt) return false;
- if (deliveryAttempts != that.deliveryAttempts) return false;
- if (firstSentAt != that.firstSentAt) return false;
- if (appID != null ? !appID.equals(that.appID) : that.appID != null) return false;
- if (data != null ? !data.equals(that.data) : that.data != null) return false;
- if (deliveryStatus != null ? !deliveryStatus.equals(that.deliveryStatus) : that.deliveryStatus != null)
- return false;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (links != null ? !links.equals(that.links) : that.links != null) return false;
- if (self != null ? !self.equals(that.self) : that.self != null) return false;
- //noinspection RedundantIfStatement
- if (topic != null ? !topic.equals(that.topic) : that.topic != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return "Notification{" +
- "type='" + type + '\'' +
- ", id='" + id + '\'' +
- ", topic='" + topic + '\'' +
- ", appID='" + appID + '\'' +
- ", data=" + data +
- ", deliveryStatus='" + deliveryStatus + '\'' +
- ", deliveryAttempts=" + deliveryAttempts +
- ", deliveredAt=" + deliveredAt +
- ", firstSentAt=" + firstSentAt +
- ", createdAt=" + createdAt +
- ", links=" + links +
- ", self=" + self +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/NotificationCollection.java b/intercom-java/src/main/java/io/intercom/api/NotificationCollection.java
deleted file mode 100644
index ff27f3c8..00000000
--- a/intercom-java/src/main/java/io/intercom/api/NotificationCollection.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Iterator;
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class NotificationCollection extends TypedDataCollection implements Iterator {
-
- protected TypedDataCollectionIterator iterator;
-
- public NotificationCollection() {
- type = "notification.list";
- iterator = new TypedDataCollectionIterator(this);
- }
-
- @Override
- public NotificationCollection nextPage() {
- return fetchNextPage(NotificationCollection.class);
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("notifications")
- @Override
- public List getPage() {
- return super.getPage();
- }
-
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public Notification next() {
- return iterator.next();
- }
-
- public void remove() {
- iterator.remove();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/NotificationData.java b/intercom-java/src/main/java/io/intercom/api/NotificationData.java
deleted file mode 100644
index 0aa6d230..00000000
--- a/intercom-java/src/main/java/io/intercom/api/NotificationData.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class NotificationData extends TypedData {
-
- @JsonProperty("type")
- protected String type;
-
- @JsonProperty
- private Map item;
-
- public NotificationData() {
- type = "notification_event_data";
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map getItem() {
- return item;
- }
-
- public void setItem(Map item) {
- this.item = item;
- }
-
- @Override
- public int hashCode() {
- return item != null ? item.hashCode() : 0;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- NotificationData that = (NotificationData) o;
-
- //noinspection RedundantIfStatement
- if (item != null ? !item.equals(that.item) : that.item != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return "NotificationData{" +
- "type='" + type + '\'' +
- ", item=" + item +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/NotificationError.java b/intercom-java/src/main/java/io/intercom/api/NotificationError.java
deleted file mode 100644
index d72fc2f9..00000000
--- a/intercom-java/src/main/java/io/intercom/api/NotificationError.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_DEFAULT)
-public class NotificationError extends Notification {
-
- @JsonProperty("http_request")
- private RequestResponseCapture capture;
-
- public RequestResponseCapture getCapture() {
- return capture;
- }
-
- public void setCapture(RequestResponseCapture capture) {
- this.capture = capture;
- }
-
- @Override
- public String toString() {
- return "NotificationError{" +
- "capture=" + capture +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/NotificationErrorCollection.java b/intercom-java/src/main/java/io/intercom/api/NotificationErrorCollection.java
deleted file mode 100644
index 8121449a..00000000
--- a/intercom-java/src/main/java/io/intercom/api/NotificationErrorCollection.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Iterator;
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class NotificationErrorCollection extends TypedDataCollection implements Iterator {
-
- protected TypedDataCollectionIterator iterator;
-
- public NotificationErrorCollection() {
- type = "notification.list";
- iterator = new TypedDataCollectionIterator(this);
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("notifications")
- @Override
- public List getPage() {
- return super.getPage();
- }
-
- @Override
- public NotificationErrorCollection nextPage() {
- return fetchNextPage(NotificationErrorCollection.class);
- }
-
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public NotificationError next() {
- return iterator.next();
- }
-
- public void remove() {
- iterator.remove();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/RateLimitException.java b/intercom-java/src/main/java/io/intercom/api/RateLimitException.java
deleted file mode 100644
index b4334238..00000000
--- a/intercom-java/src/main/java/io/intercom/api/RateLimitException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.intercom.api;
-
-public class RateLimitException extends IntercomException {
-
- private static final long serialVersionUID = -6100754169056165622L;
-
- public RateLimitException(String message) {
- super(message);
- }
-
- public RateLimitException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public RateLimitException(ErrorCollection errorCollection) {
- super(errorCollection);
- }
-
- public RateLimitException(ErrorCollection errorCollection, Throwable cause) {
- super(errorCollection, cause);
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Replier.java b/intercom-java/src/main/java/io/intercom/api/Replier.java
deleted file mode 100644
index 042d322b..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Replier.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package io.intercom.api;
-
-interface Replier {
-
- String getReplyType();
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Reply.java b/intercom-java/src/main/java/io/intercom/api/Reply.java
deleted file mode 100644
index 98b83be7..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Reply.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-class Reply extends TypedData {
-
- @JsonProperty("message_type")
- private final String messageType = "comment";
-
- @JsonProperty("body")
- private String body;
-
- @JsonProperty("from")
- T from;
-
- Reply() {
- }
-
- @JsonProperty("type")
- String getType() {
- return from.getReplyType();
- }
-
- String getBody() {
- return body;
- }
-
- public Reply setBody(String body) {
- this.body = body;
- return this;
- }
-
- T getFrom() {
- return from;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public Reply setFrom(T from) {
- this.from = from;
- return this;
- }
-
- String getMessageType() {
- return messageType;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Reply reply = (Reply) o;
-
- if (body != null ? !body.equals(reply.body) : reply.body != null) return false;
- if (from != null ? !from.equals(reply.from) : reply.from != null) return false;
- //noinspection RedundantIfStatement
- if (!messageType.equals(reply.messageType)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = messageType.hashCode();
- result = 31 * result + (body != null ? body.hashCode() : 0);
- result = 31 * result + (from != null ? from.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "Reply{" +
- "messageType='" + messageType + '\'' +
- ", body='" + body + '\'' +
- ", from=" + from +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/RequestResponseCapture.java b/intercom-java/src/main/java/io/intercom/api/RequestResponseCapture.java
deleted file mode 100644
index 08e7f2dc..00000000
--- a/intercom-java/src/main/java/io/intercom/api/RequestResponseCapture.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.ImmutableMap;
-
-import java.net.URI;
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class RequestResponseCapture {
-
- @JsonProperty("request_method")
- private String requestMethod;
-
- @JsonProperty("request_uri")
- private URI requestURI;
-
- @JsonProperty("request_headers")
- private Map requestHeaders;
-
- @JsonProperty("response_status_code")
- private int responseStatusCode;
-
- @JsonProperty("response_headers")
- private Map responseHeaders;
-
- @JsonProperty("response_entity")
- private String responseEntity;
-
- @JsonProperty("request_entity")
- private String requestEntity;
-
- public RequestResponseCapture() {
- }
-
- public String getRequestMethod() {
- return requestMethod;
- }
-
- public URI getRequestURI() {
- return requestURI;
- }
-
- public Map getRequestHeaders() {
- return ImmutableMap.builder().putAll(requestHeaders).build();
- }
-
- public int getResponseStatusCode() {
- return responseStatusCode;
- }
-
- public Map getResponseHeaders() {
- return ImmutableMap.builder().putAll(responseHeaders).build();
- }
-
- public String getResponseEntity() {
- return responseEntity;
- }
-
- public String getRequestEntity() {
- return requestEntity;
- }
-
-}
\ No newline at end of file
diff --git a/intercom-java/src/main/java/io/intercom/api/Segment.java b/intercom-java/src/main/java/io/intercom/api/Segment.java
deleted file mode 100644
index 0b12c019..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Segment.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-
-import java.util.HashMap;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Segment extends TypedData {
-
- private static final HashMap SENTINEL = Maps.newHashMap();
-
- public static Segment find(String id) throws InvalidException, AuthorizationException {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path("segments").path(id).build());
- return resource.get(Segment.class);
- }
-
- public static SegmentCollection list() throws InvalidException, AuthorizationException {
- return DataResource.list(SENTINEL, "segments", SegmentCollection.class);
- }
-
- public static Segment update(Segment segment) throws InvalidException, AuthorizationException {
- if (segment.getId() == null) {
- throw new InvalidException("segment updates must supply an id");
- }
- return DataResource.update(segment, "segments", Segment.class);
- }
-
- @JsonProperty("type")
- private final String type = "segment";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("name")
- private String name;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("updated_at")
- private long updatedAt;
-
- @SuppressWarnings("WeakerAccess")
- public Segment() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public Segment setName(String name) {
- this.name = name;
- return this;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public long getUpdatedAt() {
- return updatedAt;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Segment segment = (Segment) o;
-
- if (createdAt != segment.createdAt) return false;
- if (updatedAt != segment.updatedAt) return false;
- if (id != null ? !id.equals(segment.id) : segment.id != null) return false;
- if (name != null ? !name.equals(segment.name) : segment.name != null) return false;
- //noinspection RedundantIfStatement
- if (!type.equals(segment.type)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
- return result;
- }
-
- @Override
- public String toString() {
- return "Segment{" +
- "id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", createdAt=" + createdAt +
- ", updatedAt=" + updatedAt +
- "} " + super.toString();
- }
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/SegmentCollection.java b/intercom-java/src/main/java/io/intercom/api/SegmentCollection.java
deleted file mode 100644
index 309697f0..00000000
--- a/intercom-java/src/main/java/io/intercom/api/SegmentCollection.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Iterator;
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class SegmentCollection extends TypedDataCollection implements Iterator {
-
- protected TypedDataCollectionIterator iterator;
-
- public SegmentCollection() {
- type = "segment.list";
- iterator = new TypedDataCollectionIterator(this);
- }
-
- @Override
- public SegmentCollection nextPage() {
- return fetchNextPage(SegmentCollection.class);
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("segments")
- @Override
- public List getPage() {
- return super.getPage();
- }
-
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public Segment next() {
- return iterator.next();
- }
-
- public void remove() {
- iterator.remove();
- }
-
- @Override
- public String toString() {
- return "SegmentCollection{" +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/ServerException.java b/intercom-java/src/main/java/io/intercom/api/ServerException.java
deleted file mode 100644
index 66475320..00000000
--- a/intercom-java/src/main/java/io/intercom/api/ServerException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.intercom.api;
-
-public class ServerException extends IntercomException {
-
- private static final long serialVersionUID = 7823280575981918941L;
-
- public ServerException(String message) {
- super(message);
- }
-
- public ServerException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ServerException(ErrorCollection errorCollection) {
- super(errorCollection);
- }
-
- public ServerException(ErrorCollection errorCollection, Throwable cause) {
- super(errorCollection, cause);
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/SocialProfile.java b/intercom-java/src/main/java/io/intercom/api/SocialProfile.java
deleted file mode 100644
index 38e89cf6..00000000
--- a/intercom-java/src/main/java/io/intercom/api/SocialProfile.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.net.URI;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class SocialProfile extends TypedData {
-
- @JsonProperty("type")
- private final String type = "social_profile";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("name")
- private String name;
-
- @JsonProperty("username")
- private String username;
-
- @JsonProperty("url")
- @JsonDeserialize(using = URIDeserializer.class)
- private URI url;
-
- public SocialProfile() {
- }
-
- public String getType() {
- return type;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getUsername() {
- return username;
- }
-
- public URI getUrl() {
- return url;
- }
-
- @Override
- public int hashCode() {
- int result = id != null ? id.hashCode() : 0;
- result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (username != null ? username.hashCode() : 0);
- result = 31 * result + (url != null ? url.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- SocialProfile that = (SocialProfile) o;
-
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (name != null ? !name.equals(that.name) : that.name != null) return false;
- if (url != null ? !url.equals(that.url) : that.url != null) return false;
- //noinspection RedundantIfStatement
- if (username != null ? !username.equals(that.username) : that.username != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return "SocialProfile{" +
- "type='" + type + '\'' +
- ", id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", username='" + username + '\'' +
- ", url=" + url +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/SocialProfileCollection.java b/intercom-java/src/main/java/io/intercom/api/SocialProfileCollection.java
deleted file mode 100644
index f35cb020..00000000
--- a/intercom-java/src/main/java/io/intercom/api/SocialProfileCollection.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class SocialProfileCollection extends TypedData {
-
- @JsonProperty("type")
- private String type = "social_profile.list";
-
- @JsonProperty("social_profiles")
- private List socialProfiles = Lists.newArrayList();
-
- SocialProfileCollection() {
- }
-
- public String getType() {
- return type;
- }
-
- public List getSocialProfiles() {
- return socialProfiles == null ? null : ImmutableList.builder().addAll(socialProfiles).build();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- SocialProfileCollection that = (SocialProfileCollection) o;
-
- if (socialProfiles != null ? !socialProfiles.equals(that.socialProfiles) : that.socialProfiles != null)
- return false;
- //noinspection RedundantIfStatement
- if (type != null ? !type.equals(that.type) : that.type != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type != null ? type.hashCode() : 0;
- result = 31 * result + (socialProfiles != null ? socialProfiles.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "SocialProfileCollection{" +
- "type='" + type + '\'' +
- ", socialProfiles=" + socialProfiles +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Subscription.java b/intercom-java/src/main/java/io/intercom/api/Subscription.java
deleted file mode 100644
index 6ad4471d..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Subscription.java
+++ /dev/null
@@ -1,419 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Subscription extends TypedData {
-
- private static final HashMap SENTINEL = Maps.newHashMap();
-
- public static Subscription create(Subscription subscription) throws InvalidException, AuthorizationException {
- return DataResource.create(subscription, "subscriptions", Subscription.class);
- }
-
- public static Subscription update(Subscription subscription) throws InvalidException, AuthorizationException {
- return DataResource.update(subscription, "subscriptions", subscription.getId(), Subscription.class);
- }
-
- public static Subscription delete(Subscription subscription) throws InvalidException, AuthorizationException {
- return DataResource.delete(subscription.getId(), "subscriptions", Subscription.class);
- }
-
- public static Subscription find(String id) throws InvalidException, AuthorizationException {
- final HttpClient resource = new HttpClient(UriBuilder.newBuilder().path("subscriptions").path(id).build());
- return resource.get(Subscription.class);
- }
-
- public static SubscriptionCollection list() throws InvalidException, AuthorizationException {
- return DataResource.list(SENTINEL, "subscriptions", SubscriptionCollection.class);
- }
-
- public static NotificationCollection sentFeed(String id) throws InvalidException, AuthorizationException {
- final URI feedURI = UriBuilder.newBuilder()
- .path("subscriptions")
- .path(id)
- .path("sent")
- .build();
- final HttpClient resource = new HttpClient(feedURI);
- return resource.get(NotificationCollection.class);
- }
-
- public static NotificationErrorCollection errorFeed(String id) throws InvalidException, AuthorizationException {
- final URI feedURI = UriBuilder.newBuilder()
- .path("subscriptions")
- .path(id)
- .path("error")
- .build();
- final HttpClient resource = new HttpClient(feedURI);
- return resource.get(NotificationErrorCollection.class);
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public static class Topic {
- private static final String SUBTYPE_WILDCARD = "*";
-
- private static final String TEXT = "text";
-
- private final static String COMPANY_NAME = "company";
-
- private final static String CONVERSATION_NAME = "conversation";
-
- private static final String USER_NAME = "user";
-
- public static final Topic PING = new Topic("ping", SUBTYPE_WILDCARD);
-
- public static final Topic COMPANY = new Topic(COMPANY_NAME, SUBTYPE_WILDCARD);
-
- public static final Topic COMPANY_CREATED = new Topic(COMPANY_NAME, "created");
-
- public static final Topic CONVERSATION = new Topic(CONVERSATION_NAME, SUBTYPE_WILDCARD);
-
- public static final Topic CONVERSATION_USER_CREATED = new Topic(CONVERSATION_NAME, "user.created");
-
- public static final Topic CONVERSATION_USER_REPLY = new Topic(CONVERSATION_NAME, "user.replied");
-
- public static final Topic CONVERSATION_ADMIN_REPLY = new Topic(CONVERSATION_NAME, "admin.replied");
-
- public static final Topic CONVERSATION_ADMIN_ASSIGNED = new Topic(CONVERSATION_NAME, "admin.assigned");
-
- public static final Topic CONVERSATION_ADMIN_CLOSED = new Topic(CONVERSATION_NAME, "admin.closed");
-
- public static final Topic CONVERSATION_ADMIN_OPEN = new Topic(CONVERSATION_NAME, "admin.open");
-
- public static final Topic CONVERSATION_ADMIN_NOTED = new Topic(CONVERSATION_NAME, "admin.noted");
-
- public static final Topic USER = new Topic(USER_NAME, SUBTYPE_WILDCARD);
-
- public static final Topic USER_CREATED = new Topic(USER_NAME, "created");
-
- public static final Topic USER_UNSUBSCRIBED = new Topic(USER_NAME, "unsubscribed");
-
- public static final Topic USER_TAG_CREATED = new Topic(USER_NAME, "tag.created");
-
- public static final Topic USER_TAG_DELETED = new Topic(USER_NAME, "tag.deleted");
-
- public static final Topic ALL_TOPIC = valueOf("all");
-
- public static Topic valueOf(String type) throws IllegalArgumentException {
- if (type.contains(".")) {
- final String[] split = type.split("\\.", 2); // fragile: assume one dot
- return new Topic(split[0], split[1]);
- } else {
- return new Topic(type);
- }
- }
-
- private String type;
-
- private String subType;
-
- private String toString;
-
- public Topic(String type) {
- this(type, SUBTYPE_WILDCARD);
- }
-
- public Topic(String type, String subType) {
- Preconditions.checkArgument(type != null, "type part cannot be null");
- Preconditions.checkArgument(subType != null, "subType part cannot be null");
- this.type = type;
- this.subType = subType;
- // memo the string representation
- if (SUBTYPE_WILDCARD.equals(subType)) {
- toString = type;
- } else {
- toString = type + "." + subType;
- }
- }
-
- public String getType() {
- return type;
- }
-
- public String getSubType() {
- return subType;
- }
-
- public boolean isCompatible(String type) {
- return this.isCompatible(valueOf(type));
- }
-
- public boolean isCompatible(Topic other) {
- if (other == null) {
- return false;
- }
- //noinspection SimplifiableIfStatement
- if (type.equalsIgnoreCase(other.type) && (subType.equals(SUBTYPE_WILDCARD) || other.subType.equals(SUBTYPE_WILDCARD))) {
- return true;
- } else {
- return this.type.equalsIgnoreCase(other.type) && this.subType.equalsIgnoreCase(other.subType);
- }
- }
-
- @Override
- public int hashCode() {
- int result = type != null ? type.hashCode() : 0;
- result = 31 * result + (subType != null ? subType.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return toString;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final Topic Topic = (Topic) o;
- if (subType != null ? !subType.equals(Topic.subType) : Topic.subType != null) {
- return false;
- }
- //noinspection RedundantIfStatement
- if (type != null ? !type.equals(Topic.type) : Topic.type != null) {
- return false;
- }
- return true;
- }
-
-
- }
-
- @SuppressWarnings("FieldCanBeLocal")
- @JsonProperty("type")
- private final String type = "notification_subscription";
-
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("created_at")
- private long createdAt;
-
- @JsonProperty("updated_at")
- private long updatedAt;
-
- @JsonProperty("service_type")
- private final String serviceType = "web";
-
- @JsonProperty("app_id")
- private String appID;
-
- @JsonProperty("url")
- private URI url;
-
- @JsonProperty("self")
- private URI self;
-
- @JsonProperty("topics")
- private List topics = Lists.newArrayList();
-
- @JsonProperty("metadata")
- private Map metadata = Maps.newHashMap();
-
- @JsonProperty("active")
- private boolean active;
-
- @JsonProperty("hub_secret")
- private String hubSecret;
-
- @JsonProperty("mode")
- private String mode = "point";
-
- @JsonProperty("links")
- private Map links = Maps.newHashMap();
-
- @JsonProperty("notes")
- private List notes = Lists.newArrayList();
-
- public Subscription() {
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public long getCreatedAt() {
- return createdAt;
- }
-
- public long getUpdatedAt() {
- return updatedAt;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public String getAppID() {
- return appID;
- }
-
- public void setAppID(String appID) {
- this.appID = appID;
- }
-
- public URI getUrl() {
- return url;
- }
-
- public void setUrl(URI url) {
- this.url = url;
- }
-
- public URI getSelf() {
- return self;
- }
-
- public List getTopics() {
- return topics;
- }
-
- public void setTopics(List topics) {
- this.topics = topics;
- }
-
- public void addTopic(Topic topic) {
- this.topics.add(topic);
- }
-
- public boolean getActive() {
- return active;
- }
-
- public void setActive(boolean active) {
- this.active = active;
- }
-
- public Map getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map metadata) {
- this.metadata = metadata;
- }
-
- public String getHubSecret() {
- return hubSecret;
- }
-
- public void setHubSecret(String hubSecret) {
- this.hubSecret = hubSecret;
- }
-
- public String getMode() {
- return mode;
- }
-
- public List getNotes() {
- return notes;
- }
-
- public void setNotes(List notes) {
- this.notes = notes;
- }
-
- @JsonIgnore
- public String getURLString() {
- return url.toASCIIString();
- }
-
- @JsonIgnore
- public boolean requiresSignature() {
- return getHubSecret() != null;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Subscription that = (Subscription) o;
-
- if (active != that.active) return false;
- if (createdAt != that.createdAt) return false;
- if (updatedAt != that.updatedAt) return false;
- if (appID != null ? !appID.equals(that.appID) : that.appID != null) return false;
- if (hubSecret != null ? !hubSecret.equals(that.hubSecret) : that.hubSecret != null) return false;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (links != null ? !links.equals(that.links) : that.links != null) return false;
- if (metadata != null ? !metadata.equals(that.metadata) : that.metadata != null) return false;
- if (mode != null ? !mode.equals(that.mode) : that.mode != null) return false;
- if (notes != null ? !notes.equals(that.notes) : that.notes != null) return false;
- if (self != null ? !self.equals(that.self) : that.self != null) return false;
- if (!serviceType.equals(that.serviceType)) return false;
- if (topics != null ? !topics.equals(that.topics) : that.topics != null) return false;
- if (!type.equals(that.type)) return false;
- //noinspection RedundantIfStatement
- if (url != null ? !url.equals(that.url) : that.url != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = type.hashCode();
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
- result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
- result = 31 * result + (serviceType.hashCode());
- result = 31 * result + (appID != null ? appID.hashCode() : 0);
- result = 31 * result + (url != null ? url.hashCode() : 0);
- result = 31 * result + (self != null ? self.hashCode() : 0);
- result = 31 * result + (topics != null ? topics.hashCode() : 0);
- result = 31 * result + (metadata != null ? metadata.hashCode() : 0);
- result = 31 * result + (active ? 1 : 0);
- result = 31 * result + (hubSecret != null ? hubSecret.hashCode() : 0);
- result = 31 * result + (mode != null ? mode.hashCode() : 0);
- result = 31 * result + (links != null ? links.hashCode() : 0);
- result = 31 * result + (notes != null ? notes.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "Subscription{" +
- "id='" + id + '\'' +
- ", createdAt=" + createdAt +
- ", updatedAt=" + updatedAt +
- ", serviceType='" + serviceType + '\'' +
- ", appID='" + appID + '\'' +
- ", url=" + url +
- ", self=" + self +
- ", topics=" + topics +
- ", metadata=" + metadata +
- ", active=" + active +
- ", hubSecret='" + hubSecret + '\'' +
- ", mode='" + mode + '\'' +
- ", links=" + links +
- ", notes=" + notes +
- "} " + super.toString();
- }
-
-
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/SubscriptionCollection.java b/intercom-java/src/main/java/io/intercom/api/SubscriptionCollection.java
deleted file mode 100644
index ac9aceeb..00000000
--- a/intercom-java/src/main/java/io/intercom/api/SubscriptionCollection.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Iterator;
-import java.util.List;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class SubscriptionCollection extends TypedDataCollection implements Iterator {
-
- protected TypedDataCollectionIterator iterator;
-
- public SubscriptionCollection() {
- iterator = new TypedDataCollectionIterator(this);
- }
-
- @Override
- public SubscriptionCollection nextPage() {
- return fetchNextPage(SubscriptionCollection.class);
- }
-
- @SuppressWarnings("EmptyMethod")
- @JsonProperty("items")
- @Override
- public List getPage() {
- return super.getPage();
- }
-
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public Subscription next() {
- return iterator.next();
- }
-
- public void remove() {
- iterator.remove();
- }
-
- @Override
- public String toString() {
- return "SubscriptionCollection{" +
- "} " + super.toString();
- }
-}
diff --git a/intercom-java/src/main/java/io/intercom/api/Tag.java b/intercom-java/src/main/java/io/intercom/api/Tag.java
deleted file mode 100644
index 2482e2ba..00000000
--- a/intercom-java/src/main/java/io/intercom/api/Tag.java
+++ /dev/null
@@ -1,250 +0,0 @@
-package io.intercom.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@SuppressWarnings("UnusedDeclaration")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Tag extends TypedData {
-
- private static final Logger logger = LoggerFactory.getLogger("intercom-java");
- private static final HashMap SENTINEL = Maps.newHashMap();
-
- public static Tag tag(Tag tag, User... users) throws InvalidException, AuthorizationException {
- return tag(tag, new UserCollection(Lists.newArrayList(users)));
- }
-
- public static Tag tag(Tag tag, Company... companies) throws InvalidException, AuthorizationException {
- return tag(tag, new CompanyCollection(Lists.newArrayList(companies)));
- }
-
- static Tag tag(Tag tag, UserCollection users) throws InvalidException, AuthorizationException {
- TaggableCollection taggableCollection = createTagTypedCollection(tag, users);
- return DataResource.create(taggableCollection, "tags", Tag.class);
- }
-
- static Tag tag(Tag tag, CompanyCollection companies) throws InvalidException, AuthorizationException {
- TaggableCollection taggableCollection = createTagTypedCollection(tag, companies);
- return DataResource.create(taggableCollection, "tags", Tag.class);
- }
-
- public static Tag create(Tag tag) throws InvalidException, AuthorizationException {
- return DataResource.create(tag, "tags", Tag.class);
- }
-
- public static Tag update(Tag tag) throws InvalidException, AuthorizationException {
- if (tag.getId() == null) {
- throw new InvalidException("tag updates must supply an id");
- }
- return DataResource.update(tag, "tags", Tag.class);
- }
-
- public static Tag delete(String id) throws InvalidException, AuthorizationException {
- return DataResource.delete(id, "tags", Tag.class);
- }
-
- public static Tag delete(Tag tag) throws InvalidException, AuthorizationException {
- return delete(tag.getId());
- }
-
- public static TagCollection list() throws InvalidException, AuthorizationException {
- return DataResource.list(SENTINEL, "tags", TagCollection.class);
- }
-
- @VisibleForTesting
- static TaggableCollection createTagTypedCollection(Tag tag, UserCollection users) {
- TaggableCollection taggableCollection = new TaggableCollection();
- taggableCollection.setName(tag.getName());
- taggableCollection.setId(tag.getId());
- final List