NowDataSDK 클래스 - Android
NowDataSDK 클래스는 NowGraphQLService, NowAttachmentService, NowTableService 및 NowAPIService와 같은 다양한 기능 서비스를 만들고 초기화할 수 있는 함수를 제공합니다.
NowDataSDK - makeGraphQLService(instanceURL: URL)
NowGraphQLService 기능의 인스턴스를 작성하고 초기화합니다. 이 서비스를 사용하면 인스턴스의 GraphQL API에 액세스할 수 있습니다 ServiceNow .
GraphQL API에 대한 ServiceNow 자세한 내용은 을 참조하십시오 GraphQL API 프레임워크를 사용하여 기록 데이터 쿼리.
| 이름 | 유형 | 설명 |
|---|---|---|
| 인스턴스 URL | URL | 액세스할 인스턴스의 URL입니다 ServiceNow . 예: "https://instance.servicenow.com" |
| 유형 | 설명 |
|---|---|
| 결과<NowGraphQLService> | NowGraphQLService 객체는 Kotlin Result 객체에 래핑됩니다. |
다음 코드 예제에서는 이 함수를 호출하는 방법을 보여 줍니다.
private var nowGraphQLService: NowGraphQLService? = null
/**
* Create the NowGraphQLService once in the lifetime of the application, inside the Application class
* or another manager class that will be injected into other classes via dagger/hilt.
* NowGraphQLService should be created after initializing the NowSDK.
*/
suspend fun getNowGraphQLService(): NowGraphQLService? {
if (nowGraphQLService != null) return nowGraphQLService
return NowDataSDK.makeGraphQLService(URL("https://instance-name.service-now.com")).getOrThrow()
.also { this.nowGraphQLService = it }
}
NowDataSDK - makeNowAPIService(instanceURL: URL)
NowAPIService 서비스의 인스턴스를 만들고 초기화합니다. 이 서비스를 사용하면 인스턴스에서 노출하는 공용 REST API에 액세스할 수 있습니다 ServiceNow .
또한 인스턴스 내에서 ServiceNow 사용자 지정 스크립트 REST API를 개발하고 NowAPIService API를 사용하여 애플리케이션 내에서 액세스할 수 있습니다Android. REST API에 대한 ServiceNow 자세한 내용은 다음 문서를 참조하십시오 스크립트 기반 REST API.
| 이름 | 유형 | 설명 |
|---|---|---|
| 인스턴스 URL | URL | 액세스할 인스턴스의 URL입니다 ServiceNow . 예: "https://instance.servicenow.com" |
| 유형 | 설명 |
|---|---|
| 결과<NowAPIService> | Kotlin Result 객체에 래핑된 NowAPIService입니다. |
다음 코드 예제에서는 이 함수를 호출하는 방법을 보여 줍니다.
private var nowApiService: NowAPIService? = null
/**
* Create the NowAPIService once in the lifetime of the application inside the Application class
* or another manager class that will be injected into other classes via dagger/hilt.
* NowAPIService should be created after initializing the NowSDK
*/
suspend fun getNowApiService(): NowAPIService? {
if (nowApiService != null) return nowApiService
return NowDataSDK.makeAPIService(URL("https://instance-name.service-now.com")).getOrThrow()
.also { this.nowApiService = it }
}
NowDataSDK - makeNowAttachmentService(instanceURL: URL)
NowAttachmentService 기능의 인스턴스를 만들고 초기화합니다.
이 서비스를 사용하면 인스턴스에서 첨부 파일을 업로드, 다운로드 및 삭제할 수 있습니다 ServiceNow . 인스턴스에 첨부 파일을 업로드하면 첨부 파일에 대한 메타데이터가 생성되어 애플리케이션에 다운로드할 Android 수 있습니다.
첨부 파일에 대한 ServiceNow 자세한 내용은 다음 문서를 참조하십시오 첨부 파일 API.
| 이름 | 유형 | 설명 |
|---|---|---|
| 인스턴스 URL | URL | 액세스할 인스턴스의 URL입니다 ServiceNow . 예: "https://instance.servicenow.com" |
| 유형 | 설명 |
|---|---|
| 결과<NowAttachmentService> | NowAttachmentService 객체를 Kotlin Result 객체에 래핑합니다. |
다음 코드 예제에서는 이 메서드를 호출하는 방법을 보여 줍니다.
private var nowAttachmentService: NowAttachmentService? = null
/**
* Create the NowAttachmentService once in the lifetime of the application inside the Application
* class or another manager class that will be injected into other classes via dagger/hilt.
* NowAttachmentService should be created after initializing the NowSDK.
*/
suspend fun getNowAttachmentService(): NowAttachmentService? {
if (nowAttachmentService != null) return nowAttachmentService
return NowDataSDK.makeAttachmentService(URL("https://instance-name.service-now.com"))
.getOrThrow()
.also { this.nowAttachmentService = it }
}
NowDataSDK - makeTableService(instanceURL: URL)
NowTableService 기능의 인스턴스를 만들고 초기화합니다.
이 서비스를 사용하면 인스턴스의 REST 테이블 API에 액세스할 수 있습니다 ServiceNow . REST 테이블 API에 대한 자세한 내용은 테이블 API를 참조하세요.
| 이름 | 유형 | 설명 |
|---|---|---|
| 인스턴스 URL | URL | 액세스할 인스턴스의 URL입니다 ServiceNow . 예: "https://instance.servicenow.com" |
| 유형 | 설명 |
|---|---|
| 결과<NowTableService> | NowTableService 객체는 Kotlin Result 객체에 래핑됩니다. |
다음 코드 예제에서는 이 함수를 호출하는 방법을 보여 줍니다.
private var nowTableService: NowTableService? = null
/**
* Create the NowTableService once in the lifetime of the application inside the Application
* class or another manager class that will be injected into other classes via dagger/hilt.
* NowTableService should be created after initializing the NowSDK.
*/
suspend fun getNowTableService(): NowTableService? {
if (nowTableService != null) return nowTableService
return NowDataSDK.makeTableService(URL("https://instance-name.service-now.com")).getOrThrow()
.also { this.nowTableService = it }
}