GrantsService
A list of all methods in the GrantsService service. Click on the method name to view detailed information about that method.
| Methods | Description |
|---|---|
| listGrants | Returns a list of all the grants belonging to a user. Grants are sorted by creation date, descending. Creation date effectively means when the grant was approved. |
| getGrantById | Returns the details of a grant. |
| revokeGrant | Revokes the specified grant. |
listGrants
Returns a list of all the grants belonging to a user. Grants are sorted by creation date, descending. Creation date effectively means when the grant was approved.
- HTTP Method:
GET - Endpoint:
/grants
Return Type
List<Grant>
Example Usage Code Snippet
import com.swagger.petstore.TestSdk;
import com.swagger.petstore.config.TestSdkConfig;
import com.swagger.petstore.models.Grant;
import java.util.List;
public class Main {
public static void main(String[] args) {
TestSdkConfig config = TestSdkConfig.builder()
.accessToken("YOUR_ACCESS_TOKEN")
.build();
TestSdk testSdk = new TestSdk(config);
List<Grant> response = testSdk.grants.listGrants();
System.out.println(response);
}
}
getGrantById
Returns the details of a grant.
- HTTP Method:
GET - Endpoint:
/grants/{grant_id}
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| grantId | String | ✅ | The ID of the grant to retrieve |
Return Type
Grant
Example Usage Code Snippet
import com.swagger.petstore.TestSdk;
import com.swagger.petstore.config.TestSdkConfig;
import com.swagger.petstore.models.Grant;
public class Main {
public static void main(String[] args) {
TestSdkConfig config = TestSdkConfig.builder()
.accessToken("YOUR_ACCESS_TOKEN")
.build();
TestSdk testSdk = new TestSdk(config);
Grant response = testSdk.grants.getGrantById("grant_id");
System.out.println(response);
}
}
revokeGrant
Revokes the specified grant.
- HTTP Method:
DELETE - Endpoint:
/grants/{grant_id}
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| grantId | String | ✅ | The ID of the grant to revoke |
Return Type
Grant
Example Usage Code Snippet
import com.swagger.petstore.TestSdk;
import com.swagger.petstore.config.TestSdkConfig;
import com.swagger.petstore.models.Grant;
public class Main {
public static void main(String[] args) {
TestSdkConfig config = TestSdkConfig.builder()
.accessToken("YOUR_ACCESS_TOKEN")
.build();
TestSdk testSdk = new TestSdk(config);
Grant response = testSdk.grants.revokeGrant("grant_id");
System.out.println(response);
}
}