Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit 39f3109

Browse files
authored
Merge pull request #25 from peternied/extensionMethods
Excellent! Thank you @peternied 👍
2 parents 4b8725d + 0df94d1 commit 39f3109

6 files changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// ------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
// ------------------------------------------------------------------------------
4+
5+
package com.microsoft.graph.extensions;
6+
7+
import android.test.AndroidTestCase;
8+
9+
import java.lang.reflect.Method;
10+
11+
/**
12+
* Created by pnied on 8/9/2016.
13+
*/
14+
public class IDriveItemRequestBuilderTests extends AndroidTestCase {
15+
16+
public void testGetItemWithPath() throws Exception {
17+
final Method getItemWithPath = IDriveItemRequestBuilder.class.getDeclaredMethod("getItemWithPath", String.class);
18+
assertNotNull(getItemWithPath);
19+
assertEquals(IDriveItemRequestBuilder.class, getItemWithPath.getReturnType());
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// ------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
// ------------------------------------------------------------------------------
4+
5+
package com.microsoft.graph.extensions;
6+
7+
import android.test.AndroidTestCase;
8+
9+
import java.lang.reflect.Method;
10+
11+
/**
12+
* Created by pnied on 8/9/2016.
13+
*/
14+
public class IThumbnailSetRequestBuilderTests extends AndroidTestCase {
15+
16+
public void testGetThumbnailSize() throws Exception {
17+
final Method getThumbnailSize = IThumbnailSetRequestBuilder.class.getDeclaredMethod("getThumbnailSize", String.class);
18+
assertNotNull(getThumbnailSize);
19+
assertEquals(IThumbnailRequestBuilder.class, getThumbnailSize.getReturnType());
20+
}
21+
}

graphsdk/src/main/java/com/microsoft/graph/extensions/DriveItemRequestBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ public class DriveItemRequestBuilder extends BaseDriveItemRequestBuilder impleme
3232
public DriveItemRequestBuilder(final String requestUrl, final IBaseClient client, final List<Option> options) {
3333
super(requestUrl, client, options);
3434
}
35+
36+
public IDriveItemRequestBuilder getItemWithPath(final String path) {
37+
return new DriveItemRequestBuilder(getRequestUrl() + ":/" + path + ":", getClient(), null);
38+
}
3539
}

graphsdk/src/main/java/com/microsoft/graph/extensions/IDriveItemRequestBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,10 @@
2222
*/
2323
public interface IDriveItemRequestBuilder extends IBaseDriveItemRequestBuilder {
2424

25+
/**
26+
* Gets the item request builder for the specified item path
27+
* @param path The path to the item
28+
* @return The request builder for the specified item
29+
*/
30+
IDriveItemRequestBuilder getItemWithPath(final String path);
2531
}

graphsdk/src/main/java/com/microsoft/graph/extensions/IThumbnailSetRequestBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@
2222
*/
2323
public interface IThumbnailSetRequestBuilder extends IBaseThumbnailSetRequestBuilder {
2424

25+
26+
/**
27+
* Gets a request for a thumbnail of a specific size
28+
* @param size The size to request (typically: small, medium, large)
29+
* @return The request builder for that thumbnail size
30+
*/
31+
IThumbnailRequestBuilder getThumbnailSize(final String size);
2532
}

graphsdk/src/main/java/com/microsoft/graph/extensions/ThumbnailSetRequestBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ public class ThumbnailSetRequestBuilder extends BaseThumbnailSetRequestBuilder i
3232
public ThumbnailSetRequestBuilder(final String requestUrl, final IBaseClient client, final List<Option> options) {
3333
super(requestUrl, client, options);
3434
}
35+
36+
@Override
37+
public IThumbnailRequestBuilder getThumbnailSize(final String size) {
38+
return new ThumbnailRequestBuilder(getRequestUrlWithAdditionalSegment(size), getClient(), /* options */ null);
39+
}
3540
}

0 commit comments

Comments
 (0)