networking
3
总安装量
3
周安装量
#57842
全站排名
安装命令
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-android --skill networking
Agent 安装分布
claude-code
3
mcpjam
2
command-code
2
gemini-cli
2
junie
2
windsurf
2
Skill 文档
API Integration Skill
Quick Start
Retrofit Setup
interface UserApi {
@GET("/users/{id}")
suspend fun getUser(@Path("id") id: Int): UserDto
@POST("/users")
suspend fun createUser(@Body user: UserDto): UserDto
}
val retrofit = Retrofit.Builder()
.baseUrl("https://api.example.com/")
.addConverterFactory(GsonConverterFactory.create())
.build()
val api = retrofit.create(UserApi::class.java)
OkHttp Configuration
val client = OkHttpClient.Builder()
.addInterceptor(HttpLoggingInterceptor())
.connectTimeout(30, TimeUnit.SECONDS)
.certificatePinner(CertificatePinner.Builder()
.add("api.example.com", "sha256/...").build())
.build()
Error Handling
sealed class Result<T> {
data class Success<T>(val data: T) : Result<T>()
data class Error<T>(val exception: Exception) : Result<T>()
}
Key Concepts
HTTP Methods
- GET: Fetch data
- POST: Create resource
- PUT/PATCH: Update
- DELETE: Remove
Retrofit Features
- Type-safe interfaces
- Automatic serialization
- Suspend function support
- Error callbacks
Network Security
- HTTPS/TLS enforcement
- SSL pinning
- Certificate validation
- Secure token storage
Best Practices
â Use HTTPS always â Implement SSL pinning â Handle errors gracefully â Optimize request/response size â Cache when possible