-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from jottley/develop
Add Limits API, Bug fixes, Library updates
- Loading branch information
Showing
15 changed files
with
1,098 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
src/main/java/org/springframework/social/salesforce/api/AbstractLimits.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* Copyright (C) 2019 https://github.com/jottley/spring-social-salesforce | ||
* | ||
* 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. | ||
*/ | ||
package org.springframework.social.salesforce.api; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAnyGetter; | ||
import com.fasterxml.jackson.annotation.JsonAnySetter; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
/** | ||
* The core limits properties. Any additional limits for connected apps can call | ||
* be found in the additional properties | ||
* | ||
* @author Jared Ottley | ||
*/ | ||
public class AbstractLimits implements Serializable { | ||
|
||
private static final long serialVersionUID = 6213553807904726408L; | ||
|
||
@JsonProperty("Max") | ||
private int max; | ||
|
||
@JsonProperty("Remaining") | ||
private int remaining; | ||
|
||
@JsonIgnore | ||
private Map<String, Object> additionalProperties = new HashMap<String, Object>(); | ||
|
||
/** | ||
* NOOP | ||
*/ | ||
public AbstractLimits() { | ||
|
||
} | ||
|
||
/** | ||
* | ||
* @param remaining | ||
* @param max | ||
*/ | ||
public AbstractLimits(int max, int remaining) { | ||
this.max = max; | ||
this.remaining = remaining; | ||
} | ||
|
||
@JsonProperty("Max") | ||
public int getMax() { | ||
return max; | ||
} | ||
|
||
@JsonProperty("Remaining") | ||
public int getRemaining() { | ||
return remaining; | ||
} | ||
|
||
@JsonAnyGetter | ||
public Map<String, Object> getAdditionalProperties() { | ||
return this.additionalProperties; | ||
} | ||
|
||
@JsonAnySetter | ||
public void setAdditionalProperty(String name, Object value) { | ||
this.additionalProperties.put(name, value); | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/org/springframework/social/salesforce/api/LimitResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright (C) 2019 https://github.com/jottley/spring-social-salesforce | ||
* | ||
* 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. | ||
*/ | ||
package org.springframework.social.salesforce.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import org.springframework.social.salesforce.api.AbstractLimits; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
/** | ||
* @author Jared Ottley | ||
*/ | ||
public class LimitResult extends AbstractLimits { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* No args constructor for use in serialization | ||
* | ||
*/ | ||
public LimitResult() { | ||
super(); | ||
} | ||
|
||
/** | ||
* | ||
* @param remaining | ||
* @param max | ||
*/ | ||
public LimitResult(Integer max, Integer remaining) { | ||
super(max, remaining); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/org/springframework/social/salesforce/api/LimitsOperations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (C) 2019 https://github.com/jottley/spring-social-salesforce | ||
* | ||
* 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. | ||
*/ | ||
package org.springframework.social.salesforce.api; | ||
|
||
/** | ||
* Defines operations for interacting with the Limits API. | ||
* | ||
* @author Jared Ottley | ||
*/ | ||
public interface LimitsOperations { | ||
|
||
|
||
/** | ||
* Retrieve the organization limits | ||
* | ||
* @return LimitsResults | ||
*/ | ||
public LimitsResults getLimits(); | ||
|
||
/** | ||
* Get the current Daily API limit. This value is returned in a header from Salesforce. The value is persisted here after each API call. | ||
* @return | ||
*/ | ||
public int getDailyApiLimit(); | ||
|
||
|
||
/** | ||
* Get the current Daily API usage. This value is returned in a header from Salesforce. The value is persisted here after each API call. | ||
* @return | ||
*/ | ||
public int getDailyApiUsed(); | ||
|
||
} |
Oops, something went wrong.