title | topic | type |
---|---|---|
Introduction |
introduction |
explanation |
Our APIs are hosted at https://api.wgtwo.com
protobufs | github.com/working-group-two/wgtwoapis › wgtwo |
OpenAPI | github.com/working-group-two/wgtwoapis › openapi |
Sample CLI app written in Kotlin: wgtwo-kotlin-code-snippets
API keys are managed via https://console.wgtwo.com
Working Group Two's public API can be found at https://github.com/working-group-two/wgtwoapis
We do use Google's Well-Known Types in our gRPC APIs.
They may be managed using the following dependency:
val timeout: com.google.protobuf.Duration = Durations.fromSeconds(15)
import com.google.protobuf.Timestamp
import com.google.protobuf.util.Durations
import com.google.protobuf.util.Timestamps
import java.time.Duration
import java.time.Instant
fun com.google.protobuf.Duration.toJavaDuration() = Duration.ofNanos(Durations.toNanos(this))
fun Duration.toProtobufDuration() = Durations.fromNanos(this.toNanos())
fun Instant.toProtoTimeStamp(): Timestamp = Timestamps.fromMillis(this.toEpochMilli())
fun Timestamp.toInstant(): Instant = Instant.ofEpochMilli(Timestamps.toMillis(this))
All APIs using wgtwo.common.v0.PhoneNumber
expects a phone number formatted as E.164 with a leading plus sign.
You may include the following dependency to manage this:
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber
import com.wgtwo.api.auth.v0.UserTokensProto
import com.wgtwo.api.util.phonenumber.PhoneNumbers
fun PhoneNumber.toPhoneNumberProto() = PhoneNumbers.toPhoneNumberProto(this)
val phoneNumber: PhoneNumber = PhoneNumbers.of("+47 xxx xx xxx")
val request: UserTokensProto.ListUserTokenRequest = UserTokensProto.ListUserTokenRequest.newBuilder()
.setPhoneNumber(phoneNumber.toPhoneNumberProto())
.build()