Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kotlin 添加apiKey改进查询参数_Kotlin_Retrofit - Fatal编程技术网

Kotlin 添加apiKey改进查询参数

Kotlin 添加apiKey改进查询参数,kotlin,retrofit,Kotlin,Retrofit,我正在使用Kotlin开发一个新闻源应用程序 public interface NewsAPI { @GET("v2/top-headlines") fun getTooNews( @Query("my_apiKey") String "apiKey"); ) } 这是通过查询参数添加apiKey的正确方法吗 否。请使用apiKey:String而不是字符串“apiKey”。是的,这是一种方法,除非您有一个额外的

我正在使用Kotlin开发一个新闻源应用程序

public interface NewsAPI {

    @GET("v2/top-headlines")
        fun getTooNews(
            @Query("my_apiKey") String "apiKey");
            )
    }
这是通过查询参数添加
apiKey
的正确方法吗


否。请使用apiKey:String而不是字符串“apiKey”。

是的,这是一种方法,除非您有一个额外的“”,这会发出警告,并重复使用分号。是的,Kotlin不像java那样使用分号。