go-sdk/docs/migrate-v0.11-to-v0.12.md
6543 fb42ca1c8d
All checks were successful
continuous-integration/drone/push Build is passing
Introduce NotifySubjectState (#520)
close #515

Reviewed-on: #520
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2021-07-01 05:06:50 +08:00

4.2 KiB

Migration Guide: v0.11 to v0.12

v0.12.0 introduces a number of breaking changes, through which it should not be difficult to migrate. Just follow this guid and if you still encounter problems, ask for help on discord or feel free to create an issue.

List Functions now always need an ListOption as argument

since paggination is introduced in gitea v1.12.0 for all list endpoints, all List Functions acept at least Page and PageSize.

If the function had had already an Option struct as argument this one is now extendet, if not a new Options type was created.

  • migrate old paggination arguments to the new One.
  • add a empty Option struct if a new one was created.

Pulls:

Authentification was removed from all Functions

for Authentification the default credentials/token is used, witch was set on Client initialisation.

for RepoWatch functions remove arguments:

  • GetWatchedRepos: password (second)
  • WatchRepo: username (first), password (second)
  • UnWatchRepo: username (first), password (second)

for Token functions remove:

  • the first two argument (user & password), these functions still relay on BasicAuth so if not done, just set username, password and optional otp before executing them.
client.SetBasicAuth(username, password)
client.SetOTP(otp)

Pulls:

Some Functions where deleted

Functions where deleted because they where only workarounds or are helper functions witch could be replaced easely.

  • BasicAuthEncode if you realy need this just copy the function into your project:
    func BasicAuthEncode(user, pass string) string {
    		  return base64.StdEncoding.EncodeToString([]byte(user + ":" + pass))
    }
    
  • ListUserIssues If you realy need this just use the Workaround witch was removed with #262 and If you have time a pull upstream to gitea for a real API is always wellcome

Pulls:

SearchUsers arguments are move to an Option struct

Old: client.SearchUsers(query, limit) New: client.SearchUsers(SearchUsersOption{KeyWord: "query", Page: 1, PageSize: limit})

Pull: #248 extend SearchUsers

ListRepoTopics return now string slice directly

ListRepoTopics returned a struct with Topics string slice. Now it return the falue of this string slice directly

Old:

client.SetRepoTopics(user, repo, TopicsList{topic_slice})

New:

client.SetRepoTopics(user, repo, topic_slice)

Pull: #276 Refactor List/SetRepoTopics

MergePullRequestOption field names changed and Enum is now used

Rename MergeTitleField to Title Rename MergeMessageField to Message

Do is now called Style and expect predefined falues: MergeStyleMerge, MergeStyleRebase, MergeStyleRebaseMerge & MergeStyleSquash

Pull: #328 PullMerge: use enum for MergeStyle