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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [3.0.6] - 2023-07-11

### Added

- Added the PageIterator functionality for Kiota generated service libraries.

## [3.0.5] - 2023-06-15

### Added
Expand Down
3 changes: 0 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ buildscript {
repositories {
google()
gradlePluginPortal()
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph
mavenArtifactId = microsoft-graph-core
mavenMajorVersion = 3
mavenMinorVersion = 0
mavenPatchVersion = 5
mavenPatchVersion = 6
mavenArtifactSuffix =

#These values are used to run functional tests
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/com/microsoft/graph/CoreConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private CoreConstants() {}
private static class VersionValues {
private static final int MAJOR = 3;
private static final int MINOR = 0;
private static final int PATCH = 5;
private static final int PATCH = 6;
}

/**
Expand Down Expand Up @@ -88,7 +88,27 @@ private Serialization(){}
public static final String ODATA_TYPE = "@odata.type";
/** OData nextLink property */
public static final String ODATA_NEXT_LINK = "@nextLink";
}

/**
* Odata Instance Annotation Constants
*/
public static class OdataInstanceAnnotations {
private OdataInstanceAnnotations(){}
/** NextLink odata instance annotation */
public static final String NEXT_LINK = "@odata.nextLink";
/** DeltaLink odata instance annotation */
public static final String DELTA_LINK = "@odata.deltaLink";
}

/**
* Collection Response Method Name Constants
*/
public static class CollectionResponseMethods {
private CollectionResponseMethods(){}
/** Method name constant for getOdataDeltaLink in collection responses*/
public static final String GET_ODATA_DELTA_LINK = "getOdataDeltaLink";
/** Method name constant for getOdataNextLink in collection responses*/
public static final String GET_ODATA_NEXT_LINK = "getOdataNextLink";
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.microsoft.graph.content;

import com.google.common.base.Strings;
import com.google.gson.*;
import com.google.gson.stream.JsonWriter;
import com.microsoft.graph.CoreConstants;
Expand Down Expand Up @@ -127,9 +128,8 @@ public CompletableFuture<String> addBatchRequestStep(@Nonnull RequestInformation
* @return True if the request was removed, false otherwise.
*/
public boolean removeBatchRequestStepWithId(@Nonnull String requestId) {
Objects.requireNonNull(requestId);
if(requestId.isEmpty()) {
throw new IllegalArgumentException("requestId cannot be empty.");
if(Strings.isNullOrEmpty(requestId)) {
throw new IllegalArgumentException("requestId cannot be null or empty.");
}
boolean isRemoved = false;
if(this.batchRequestSteps.containsKey(requestId)) {
Expand Down Expand Up @@ -262,7 +262,7 @@ private boolean containsCorrespondingRequestId(List<String> dependsOn) {
private String getRelativeUrl(HttpUrl url) {
String query = url.encodedQuery(); //Query must be encoded in order for batch requests to work.
String path = url.encodedPath().substring(5);
if(query == null || query.isEmpty()) {
if(Strings.isNullOrEmpty(query)) {
return path;
}
return (path + "?" + query); // `v1.0/` and `beta/` are both 5 characters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.microsoft.graph.exceptions;

import com.google.common.base.Strings;
import com.microsoft.kiota.ApiException;
import com.microsoft.kiota.serialization.AdditionalDataHolder;
import com.microsoft.kiota.serialization.Parsable;
Expand Down Expand Up @@ -105,7 +106,7 @@ public void setRawResponseBody(@Nonnull String rawResponseBody) {
* @return a boolean declaring whether the error code was found within the error stack.
*/
public boolean isMatch(@Nonnull String errorCode) {
if(errorCode.trim().isEmpty()) {
if(Strings.isNullOrEmpty(errorCode)) {
throw new IllegalArgumentException("Parameter 'errorCode 'cannot be null or empty");
}
return (this.rawResponseBody.toLowerCase(Locale.ROOT).contains(errorCode.toLowerCase(Locale.ROOT)))
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/microsoft/graph/models/BatchRequestStep.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.microsoft.graph.models;

import com.google.common.base.Strings;
import com.microsoft.graph.exceptions.ErrorConstants;
import okhttp3.Request;

Expand All @@ -23,10 +24,9 @@ public class BatchRequestStep {
* @param request The request
*/
public BatchRequestStep(@Nonnull String requestId, @Nonnull Request request) {
Objects.requireNonNull(requestId, ErrorConstants.Messages.NULL_PARAMETER + "requestId");
Objects.requireNonNull(request, ErrorConstants.Messages.NULL_PARAMETER + "request");
if(requestId.isEmpty()) {
throw new IllegalArgumentException("requestId cannot be empty.");
if(Strings.isNullOrEmpty(requestId)) {
throw new IllegalArgumentException("requestId cannot be null or empty.");
}
this.requestId = requestId;
this.request = request;
Expand Down Expand Up @@ -80,9 +80,8 @@ public void setDependsOn(@Nonnull List<String> dependsOn) {
* @param id The id of the request to add to the dependsOn list.
*/
public void addDependsOnId(@Nonnull String id) {
Objects.requireNonNull(id);
if(id.isEmpty()) {
throw new IllegalArgumentException("id cannot be empty");
if(Strings.isNullOrEmpty(id)) {
throw new IllegalArgumentException("id cannot be null or empty");
}
if(dependsOn == null) {
dependsOn = new ArrayList<>();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/microsoft/graph/models/UploadSession.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.microsoft.graph.models;

import com.google.common.base.Strings;
import com.microsoft.graph.exceptions.ErrorConstants;
import com.microsoft.kiota.serialization.ParseNode;
import com.microsoft.kiota.serialization.SerializationWriter;
Expand Down Expand Up @@ -46,9 +47,8 @@ public String getUploadUrl() {
* @param uploadUrl The upload url for the session.
*/
public void setUploadUrl(@Nonnull final String uploadUrl) {
Objects.requireNonNull(uploadUrl, ErrorConstants.Messages.NULL_PARAMETER + UPLOAD_URL );
if(uploadUrl.isEmpty())
throw new IllegalArgumentException("uploadUrl cannot be empty");
if(Strings.isNullOrEmpty(uploadUrl))
throw new IllegalArgumentException("uploadUrl cannot be null or empty");
this.uploadUrl = uploadUrl;
}
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.microsoft.graph.requests;

import com.google.common.base.Strings;
import com.microsoft.kiota.authentication.AuthenticationProvider;
import com.microsoft.kiota.http.OkHttpRequestAdapter;
import com.microsoft.kiota.serialization.ParseNodeFactory;
Expand Down Expand Up @@ -62,7 +63,7 @@ private static final EnumMap<Clouds, String> getCloudList() {
@SuppressWarnings("LambdaLast")
public BaseGraphRequestAdapter(@Nonnull final AuthenticationProvider authenticationProvider, @Nullable final ParseNodeFactory parseNodeFactory, @Nullable final SerializationWriterFactory serializationWriterFactory, @Nullable final OkHttpClient client, @Nullable final GraphClientOption graphClientOption, @Nullable String baseUrl) {
super(authenticationProvider, parseNodeFactory, serializationWriterFactory, client != null ? client : GraphClientFactory.create(graphClientOption).build());
if (baseUrl != null && !baseUrl.isEmpty()) {
if (!Strings.isNullOrEmpty(baseUrl)) {
setBaseUrl(baseUrl);
} else {
setBaseUrl(determineBaseAddress(null, null));
Expand Down
21 changes: 9 additions & 12 deletions src/main/java/com/microsoft/graph/requests/GraphClientOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.google.common.base.Strings;
import com.microsoft.graph.CoreConstants;
import com.microsoft.graph.exceptions.ErrorConstants;
import com.microsoft.kiota.RequestOption;
Expand Down Expand Up @@ -35,9 +36,8 @@ public GraphClientOption() {
* @param clientRequestId the client request id to set, preferably the string representation of a GUID
*/
public void setClientRequestId(@Nonnull final String clientRequestId) {
Objects.requireNonNull(clientRequestId, ErrorConstants.Messages.NULL_PARAMETER + "clientRequestId");
if(clientRequestId.isEmpty()) {
throw new IllegalArgumentException("clientRequestId cannot be empty");
if(Strings.isNullOrEmpty(clientRequestId)) {
throw new IllegalArgumentException("clientRequestId cannot be null or empty");
}
this.clientRequestId = clientRequestId;
}
Expand All @@ -57,10 +57,9 @@ public String getClientRequestId() {
* @param clientLibraryVersion client library version specified by user.
*/
public void setClientLibraryVersion(@Nonnull final String clientLibraryVersion) {
Objects.requireNonNull(clientLibraryVersion, ErrorConstants.Messages.NULL_PARAMETER + "clientLibraryVersion");
if(clientLibraryVersion.isEmpty())
if(Strings.isNullOrEmpty(clientLibraryVersion))
{
throw new IllegalArgumentException("clientLibraryVersion cannot be empty");
throw new IllegalArgumentException("clientLibraryVersion cannot be null or empty");
}
this.clientLibraryVersion = clientLibraryVersion;
}
Expand All @@ -78,10 +77,9 @@ public String getClientLibraryVersion() {
* @param coreLibraryVersion core library version specified by user.
*/
public void setCoreLibraryVersion(@Nonnull final String coreLibraryVersion) {
Objects.requireNonNull(coreLibraryVersion, ErrorConstants.Messages.NULL_PARAMETER + "coreLibraryVersion");
if(coreLibraryVersion.isEmpty())
if(Strings.isNullOrEmpty(coreLibraryVersion))
{
throw new IllegalArgumentException("coreLibraryVersion cannot be empty");
throw new IllegalArgumentException("coreLibraryVersion cannot be null or empty");
}
this.coreLibraryVersion = coreLibraryVersion;
}
Expand All @@ -99,10 +97,9 @@ public String getCoreLibraryVersion() {
* @param graphServiceVersion the version of the Api endpoint we are targeting
*/
public void setGraphServiceTargetVersion(@Nonnull final String graphServiceVersion) {
Objects.requireNonNull(graphServiceVersion, ErrorConstants.Messages.NULL_PARAMETER + "graphServiceVersion");
if(graphServiceVersion.isEmpty())
if(Strings.isNullOrEmpty(graphServiceVersion))
{
throw new IllegalArgumentException("graphServiceVersion cannot be empty");
throw new IllegalArgumentException("graphServiceVersion cannot be null or empty");
}
this.graphServiceTargetVersion = graphServiceVersion;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.microsoft.graph.requests.upload;

import com.google.common.base.Strings;
import com.microsoft.graph.models.IUploadSession;
import com.microsoft.kiota.*;
import com.microsoft.kiota.serialization.Parsable;
Expand Down Expand Up @@ -34,11 +35,11 @@ public UploadSessionRequestBuilder(@Nonnull String sessionUrl,
@Nonnull final ParsableFactory<T> factory) {
this.responseHandler = new UploadResponseHandler();
this.requestAdapter = Objects.requireNonNull(requestAdapter);
this.urlTemplate = Objects.requireNonNull(sessionUrl);
if(sessionUrl.isEmpty())
if(Strings.isNullOrEmpty(sessionUrl))
{
throw new IllegalArgumentException("sessionUrl cannot be empty");
throw new IllegalArgumentException("sessionUrl cannot be null or empty");
}
this.urlTemplate = sessionUrl;
this.factory = Objects.requireNonNull(factory);
}
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.microsoft.graph.requests.upload;

import com.google.common.base.Strings;
import com.microsoft.graph.models.UploadResult;
import com.microsoft.kiota.*;
import com.microsoft.kiota.serialization.Parsable;
Expand Down Expand Up @@ -44,11 +45,11 @@ public UploadSliceRequestBuilder(@Nonnull String sessionUrl,
long rangeEnd,
long totalSessionLength,
@Nonnull ParsableFactory<T> factory) {
this.urlTemplate = Objects.requireNonNull(sessionUrl);
if(sessionUrl.isEmpty())
if(Strings.isNullOrEmpty(sessionUrl))
{
throw new IllegalArgumentException("sessionUrl cannot be empty");
throw new IllegalArgumentException("sessionUrl cannot be null or empty");
}
this.urlTemplate = sessionUrl;
this.requestAdapter = Objects.requireNonNull(requestAdapter);
this.factory = factory;
this.rangeBegin = rangeBegin;
Expand Down
Loading