Skip to content

Commit 45de65e

Browse files
authored
New client (#50)
1 parent 309c67c commit 45de65e

File tree

228 files changed

+11651
-11423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+11651
-11423
lines changed

.gitignore

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
11
*.class
2-
.idea
3-
*.iml
4-
5-
# Mobile Tools for Java (J2ME)
6-
.mtj.tmp/
7-
8-
# Package Files #
92
*.jar
103
*.war
114
*.ear
12-
13-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
14-
hs_err_pid*
15-
16-
# Maven
5+
.gradle/
6+
.idea/
7+
.syntastic_javac_config
8+
build/
9+
gradle.properties
10+
gradle/
11+
gradlew
12+
gradlew.bat
13+
out/
1714
target/
18-
pom.xml.tag
19-
pom.xml.releaseBackup
20-
pom.xml.versionsBackup
21-
pom.xml.next
22-
release.properties
23-
dependency-reduced-pom.xml
24-
buildNumber.properties
25-
.mvn/timing.properties

.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oracle64-10.0.2

.travis/publish.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

.travis/settings.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

LICENSE renamed to LICENCE

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-2017 Stream.io Inc, and individual contributors.
1+
Copyright (c) 2016-2018 Stream.io Inc, and individual contributors.
22

33
All rights reserved.
44

@@ -24,25 +24,4 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
2424
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2525
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
2626
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27-
POSSIBILITY OF SUCH DAMAGE.
28-
29-
This software incorporates additional Open Source components. You can find the source code of these
30-
open source projects along with license information below.
31-
32-
Base64.java:
33-
34-
https://github.com/android/platform_frameworks_base/blob/master/core/java/android/util/Base64.java
35-
36-
Copyright (C) 2010 The Android Open Source Project
37-
38-
Licensed under the Apache License, Version 2.0 (the "License");
39-
you may not use this file except in compliance with the License.
40-
You may obtain a copy of the License at
41-
42-
http://www.apache.org/licenses/LICENSE-2.0
43-
44-
Unless required by applicable law or agreed to in writing, software
45-
distributed under the License is distributed on an "AS IS" BASIS,
46-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47-
See the License for the specific language governing permissions and
48-
limitations under the License.
27+
POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 15 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,25 @@
11
stream-java
22
===========
3-
[![Build Status](https://travis-ci.org/GetStream/stream-java.svg?branch=master)](https://travis-ci.org/GetStream/stream-java)
4-
53
[stream-java](https://github.com/GetStream/stream-java) is a Java client for [Stream](https://getstream.io/).
64

75
You can sign up for a Stream account at https://getstream.io/get_started.
86

9-
The Stream's Java client come in two different flavours, you should decide which one to drag into your project.
10-
Those two implementations differ according to the underlying library used to handle HTTP connections:
11-
12-
- *stream-repo-apache* uses Apache HttpClient and we recommend it for backend applications. Apache HttpClient is a mature, reliable and rock-solid HTTP library.
13-
- *stream-repo-okhttp* uses Square's OkHttp which is lightweight, powerful and mobile-oriented HTTP library. We recommend it for mobile application.
14-
157
### Installation
168

17-
If you decide to go for the *Apache HttpClient* implementation, add the following dependency to your pom.xml:
18-
19-
```xml
20-
<dependency>
21-
<groupId>io.getstream.client</groupId>
22-
<artifactId>stream-repo-apache</artifactId>
23-
<version>2.1.3</version>
24-
</dependency>
25-
```
26-
27-
or in your build.gradle:
28-
29-
```gradle
30-
compile 'io.getstream.client:stream-repo-apache:2.1.3'
31-
```
32-
33-
Instead, if you opted for the *OkHttp* implementation please add it to your pom.xml
9+
Add the following dependency to your pom.xml:
3410

3511
```xml
3612
<dependency>
3713
<groupId>io.getstream.client</groupId>
38-
<artifactId>stream-repo-okhttp</artifactId>
39-
<version>2.1.3</version>
14+
<artifactId>stream-java</artifactId>
15+
<version>3.0.0</version>
4016
</dependency>
4117
```
4218

4319
or in your build.gradle:
4420

4521
```gradle
46-
compile 'io.getstream.client:stream-repo-okhttp:2.1.3'
22+
compile 'io.getstream.client:stream-java:3.0.0'
4723
```
4824

4925
In case you want to download the artifact and put it manually into your project,
@@ -55,127 +31,32 @@ Snapshots of the development version are available in [Sonatype](https://oss.son
5531

5632
This API Client project requires Java SE 8.
5733

58-
See the [Travis configuration](.travis.yml) for details of how it is built, tested and packaged.
59-
6034
### Full documentation
6135

6236
Documentation for this Java client are available at the [Stream website](https://getstream.io/docs/?language=java).
6337

64-
### Usage
65-
66-
```java
67-
/**
68-
* Instantiate a new client to connect to us east API endpoint
69-
* Find your API keys here https://getstream.io/dashboard/
70-
**/
71-
72-
StreamClient streamClient = new StreamClientImpl(new ClientConfiguration(), "<API_KEY>", "<API_SECRET>");
73-
```
74-
75-
#### Create a new Feed
76-
77-
```java
78-
/* Instantiate a feed object */
79-
Feed feed = streamClient.newFeed("user", "1");
80-
```
81-
82-
#### Working with Activities
83-
84-
```java
85-
/* Create an activity service */
86-
FlatActivityServiceImpl<SimpleActivity> flatActivityService = feed.newFlatActivityService(SimpleActivity.class);
87-
88-
/* Get activities from 5 to 10 (using offset pagination) */
89-
FeedFilter filter = new FeedFilter.Builder().withLimit(5).withOffset(5).build();
90-
List<SimpleActivity> activities = flatActivityService.getActivities(filter).getResults();
91-
92-
/* Filter on an id less than the given UUID */
93-
aid = "e561de8f-00f1-11e4-b400-0cc47a024be0";
94-
FeedFilter filter = new FeedFilter.Builder().withIdLowerThan(aid).withLimit(5).build();
95-
List<SimpleActivity> activities = flatActivityService.getActivities(filter).getResults();
38+
For examples have a look [here](https://github.com/GetStream/stream-java/tree/master/example/Example.java).
9639

97-
/* Create a new activity */
98-
SimpleActivity activity = new SimpleActivity();
99-
activity.setActor("user:1");
100-
activity.setObject("tweet:1");
101-
activity.setVerb("tweet");
102-
activity.setForeignId("tweet:1");
103-
SimpleActivity response = flatActivityService.addActivity(activity);
104-
105-
/* Remove an activity by its id */
106-
feed.deleteActivity("e561de8f-00f1-11e4-b400-0cc47a024be0");
107-
108-
/* Remove activities by their foreign_id */
109-
feed.deleteActivityByForeignId("tweet:1");
110-
```
111-
112-
In case you want to add a single activity to multiple feeds, you can use the batch feature _addToMany_:
113-
114-
```java
115-
/* Batch adding activities to many feeds */
116-
flatActivityService.addActivityToMany(ImmutableList.<String>of("user:1", "user:2").asList(), myActivity);
117-
```
118-
119-
The API client allows you to send activities with custom field as well, you can find a
120-
complete example [here](https://github.com/GetStream/stream-java/blob/master/stream-repo-apache/src/test/java/io/getstream/client/example/mixtype/MixedType.java)
121-
122-
#### Follow and Unfollow
123-
124-
```java
125-
/* Follow another feed */
126-
feed.follow(flat", "42");
127-
128-
/* Stop following another feed */
129-
feed.unfollow(flat", "42");
130-
131-
/* Retrieve first 10 followers of a feed */
132-
FeedFilter filter = new FeedFilter.Builder().withLimit(10).build();
133-
List<FeedFollow> followingPaged = feed.getFollowing(filter);
134-
135-
/* Retrieve the first 10 followed feeds */
136-
FeedFilter filter = new FeedFilter.Builder().withLimit(10).build();
137-
List<FeedFollow> followingPaged = feed.getFollowing(filter);
138-
```
139-
140-
In case you want to send to Stream a long list of following relationships you can use the batch feature _followMany_:
141-
142-
```java
143-
/* Batch following many feeds */
144-
FollowMany followMany = new FollowMany.Builder()
145-
.add("user:1", "user:2")
146-
.add("user:1", "user:3")
147-
.add("user:1", "user:4")
148-
.add("user:2", "user:3")
149-
.build();
150-
feed.followMany(followMany);
151-
152-
```
153-
154-
#### Client token
155-
156-
In order to generate a token for client side usage (e.g. JS client), you can use the following code:
157-
158-
```java
159-
/* Generating tokens for client side usage */
160-
String token = feed.getToken();
161-
```
40+
Docs are available on [GetStream.io](http://getstream.io/docs/).
16241

163-
#### Further references
42+
Javadocs are available [here](https://getstream.github.io/stream-java/).
16443

165-
For more examples have a look [here](https://github.com/GetStream/stream-java/tree/master/stream-repo-apache/src/test/java/io/getstream/client/apache/example).
44+
### Building & Testing
16645

167-
Docs are available on [GetStream.io](http://getstream.io/docs/).
46+
Run `gradle wrapper --gradle-version 5.0` to generate gradle wrapper files
16847

169-
Javadocs are available [here](https://getstream.github.io/stream-java/).
48+
Run `gradle test` to execute integration tests
17049

17150
### Credits & Contributors
17251

173-
This project was originally contributed by [Alessandro Pieri](sirio7g), prior to him joining Stream as an employee.
52+
Project is maintained by [Max Klyga](nekuromento).
53+
54+
This project was originally contributed by [Alessandro Pieri](sirio7g).
17455

17556
We continue to welcome pull requests from community members.
17657

17758
### Copyright and License Information
17859

179-
Copyright (c) 2016-2017 Stream.io Inc, and individual contributors. All rights reserved.
60+
Copyright (c) 2016-2018 Stream.io Inc, and individual contributors. All rights reserved.
18061

181-
See the file "LICENSE" for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
62+
See the file "LICENSE" for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.

0 commit comments

Comments
 (0)