2020-07-23 06:35:58 +01:00
|
|
|
# Migration Guide: v0.12 to v0.13
|
|
|
|
|
2021-06-30 22:06:50 +01:00
|
|
|
v0.13.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.
|
2020-07-23 06:35:58 +01:00
|
|
|
|
|
|
|
<!-- toc -->
|
|
|
|
|
|
|
|
- [EditMilestoneOption use StateType (#350)](#EditMilestoneOption-use-StateType)
|
|
|
|
- [RepoSearch Options Struct was rewritten (#346)](#RepoSearch-Options-Struct-was-rewritten)
|
2020-07-30 20:46:18 +01:00
|
|
|
- [Variable Renames (#386)](#Variable-Renames)
|
2020-09-06 14:24:45 +01:00
|
|
|
- [Change Type of Permission Field (#408)](#Change-Type-of-Permission-Field)
|
2020-09-14 03:37:09 +01:00
|
|
|
- [All Function return http responce (#416)](#All-Function-return-http-responce)
|
2020-09-15 17:21:40 +01:00
|
|
|
- [NewClient has new Option Interface (#417)](#NewClient-has-new-Option-Interface)
|
2020-07-23 06:35:58 +01:00
|
|
|
|
|
|
|
<!-- tocstop -->
|
|
|
|
|
|
|
|
## EditMilestoneOption use StateType
|
|
|
|
|
2020-09-14 03:37:09 +01:00
|
|
|
Instead of a raw string StateType is now used for State too.
|
2020-07-23 06:35:58 +01:00
|
|
|
just replace old strings with new enum.
|
|
|
|
|
|
|
|
|
|
|
|
Pulls:
|
|
|
|
- [#350 EditMilestoneOption also use StateType](https://gitea.com/gitea/go-sdk/pulls/350)
|
|
|
|
|
|
|
|
|
|
|
|
## RepoSearch Options Struct was rewritten
|
|
|
|
|
2020-09-14 03:37:09 +01:00
|
|
|
Since the API itself is ugly and there was no nameconvention whats o ever.
|
|
|
|
You easely can pass the wrong options and dont get the result you want.
|
2020-07-23 06:35:58 +01:00
|
|
|
|
2020-09-14 03:37:09 +01:00
|
|
|
Now it is rewritten and translated for the API.
|
2020-07-23 06:35:58 +01:00
|
|
|
The easyest way to migrate is to look at who this function is used and rewritten that code block.
|
|
|
|
|
|
|
|
If there is a special edgecase you have you can pass a `RawQuery` to the API endpoint.
|
|
|
|
|
|
|
|
Pulls:
|
|
|
|
- [#346 Refactor RepoSearch to be easy usable](https://gitea.com/gitea/go-sdk/pulls/346)
|
2020-07-30 20:46:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
## Variable Renames
|
|
|
|
|
2020-09-14 03:37:09 +01:00
|
|
|
Some names of strcut options have been renamed to describe there function/usecase more precisely.
|
2020-07-30 20:46:18 +01:00
|
|
|
if you use `CreateOrgOption` somewhere just rename `UserName` to `Name`.
|
|
|
|
|
|
|
|
Pulls:
|
|
|
|
- [#386 CreateOrgOption rename UserName to Name](https://gitea.com/gitea/go-sdk/pulls/386)
|
2020-09-06 14:24:45 +01:00
|
|
|
|
|
|
|
## Change Type of Permission Field
|
|
|
|
|
|
|
|
The following functions are affected: ListOrgTeams, ListMyTeams, GetTeam, CreateTeam, EditTeam and AddCollaborator
|
|
|
|
|
2020-09-14 03:37:09 +01:00
|
|
|
The `Permission` field has changed type from `string` to `AccessMode`,
|
|
|
|
which represent the raw strings you must use before.
|
2020-09-06 14:24:45 +01:00
|
|
|
Just replace the string with the AccessMode equivalent.
|
|
|
|
|
|
|
|
Pulls:
|
|
|
|
- [#408 Use enum AccessMode for OrgTeam and Collaborator functions](https://gitea.com/gitea/go-sdk/pulls/408)
|
2020-09-14 03:37:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
## All Function return http responce
|
|
|
|
|
|
|
|
All functions got one new return (`Responce`)!
|
|
|
|
If you just like to migrate, add `_,` before the error return.
|
|
|
|
|
|
|
|
example:
|
|
|
|
```diff
|
|
|
|
- user, err := c.GetMyUserInfo()
|
|
|
|
+ user, _, err := c.GetMyUserInfo()
|
|
|
|
```
|
|
|
|
|
|
|
|
If you like to check responce if an error ocure, make sure responce is not nil!
|
|
|
|
If an error ocure before an http request (e.g. gitea is to old), it will be nil.
|
|
|
|
|
|
|
|
Pulls:
|
|
|
|
- [#416 All Function return http responce](https://gitea.com/gitea/go-sdk/pulls/416)
|
2020-09-15 17:21:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
## NewClient has new Option Interface
|
|
|
|
|
|
|
|
function `NewClient` use functional options now.
|
|
|
|
If you simply like to migrate replace `client := NewClient(giteaUrl, token)` with `client, _ := NewClient(giteaURL, SetToken(token))`.
|
|
|
|
|
|
|
|
If you like tu utilize them, currently there are: SetContext, SetBasicAuth, SetOTP, SetToken, SetHTTPClient, SetSudo
|
|
|
|
|
|
|
|
Pulls:
|
|
|
|
- [#417 Make http requests with context](https://gitea.com/gitea/go-sdk/pulls/417)
|