nextcloud / nextcloud/Android-SingleSignOn

Convenience features for `NextcloudRequest.Builder`

未关闭
#413 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
74
派生
36
平均合并
1 天 19 小时
30 天内合并 PR
17

描述

Issue

The following setup for a NextcloudRequest is quite verbose:

final var parameters = Collections.singleton(new QueryParam("foo", "bar"));
final var nextcloudRequest = new NextcloudRequest.Builder()
    .setMethod("GET")
    .setParameter(parameters)
    .setUrl("/endpoint")
    .build();

Especially for beginners, we should try to minimize the necessary boilerplate code to perform an actual request.

Proposal

Automatically parse QueryParams from the given URL

We could parse the QueryParams from the given URL and add them to our Collection (just as if .setParameter() would have been called). A working sample implementation (in Kotlin) is already in the nextcloud-commons library available.

final var nextcloudRequest = new NextcloudRequest.Builder()
    .setMethod("GET")
    .setParameter(parameters)
    .setUrl("/endpoint?foo=bar")
    .build();

Default method property to GET

It is the most often used HTTP verb and a natural choice to be preset (of course with keeping the possibility to override it):

final var parameters = Collections.singleton(new QueryParam("foo", "bar"));
final var nextcloudRequest = new NextcloudRequest.Builder()
    .setParameter(parameters)
    .setUrl("/endpoint")
    .build();

Looking forward to some opinions 🙂
PS.: This issue has been split out of #266

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 NextcloudRequest.Builder 的实现开始,检查 setUrl、setParameter 和 HTTP 方法在 build() 之前是如何存储的。将所要求的 URL 解析与链接的 Kotlin 示例进行比较,然后验证 URL 参数已被包含、GET 是默认值,并且显式选择的方法仍然有效。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, java
领域
mobile
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。