IDを使用した再編集

このコード・スニペットでは、IDを使ってメッセージを再編集する方法を示しています。

サンプルコードの以下の変数を置き換える:

キー説明
VONAGE_REDACT_ID

The ID of the data record that you'd like to redact

VONAGE_REDACT_TYPE

The product that the ID belongs to e.g. sms

Prerequisites

Add the following to build.gradle:

implementation 'com.vonage:server-sdk-kotlin:2.1.1'

Create a class named RedactSms and add the following code to the main method:

val client = Vonage {
    apiKey(VONAGE_API_KEY)
    apiSecret(VONAGE_API_SECRET)
}

View full source

Write the code

Add the following to the main method of the RedactSms class:

// Outbound
client.redact.redactSms(VONAGE_REDACT_ID)

// Inbound
client.redact.redactSms(VONAGE_REDACT_ID, Type.INBOUND)

View full source

Run your code

We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:

apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''

Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.redact with the package containing RedactSms:

gradle run -Pmain=com.vonage.quickstart.kt.redact.RedactSms