CHANGELOG.md 7.25 KB
Newer Older
Ben Boeckel's avatar
Ben Boeckel committed
1
# v0.1301.1
2

3
## Changes
4
5
6
7
8

  * Updated `api::projects::members::ProjectMember[s]` to support the ability
    to include member details for those members that have access as a result
    of belonging to ancestor/enclosing groups, in addition to directly added
    members.
9
10
  * Allow a label via the `api::projects::labels::Label` endpoint to be queried
    by id or name.
11

12
13
14
15
## Additions

  * Added the `api::groups::projects::GroupProjects` endpoint to list a groups
    projects.
16
17
  * Added the `api::groups::subgroups::GroupSubgroups` endpoint to list a
    groups subgroups.
18
19
  * Added the `api::projects::protected_branches::ProtectedBranches` endpoint
    to list a projects protected branches.
20
21
  * Added the `api::projects::protected_branches::ProtectedBranch` endpoint
    to query a projects protected branch.
22

23
24
25
## Fixes

  * Added pagination support to `api::projects::labels::Labels`
26
27
  * Keyset pagination also supports the to-be-removed (14.0) `Links` HTTP
    header.
28

29
# v0.1301.0
Ben Boeckel's avatar
Ben Boeckel committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

## Deprecations

  * The REST endpoint methods on the `Gitlab` structure have been removed.
    Associated helper structures for resource creation endpoints have been
    removed as well:
    - `CreateMergeRequestParams`
    - `CreateMergeRequestParamsBuilder`
    - `CreateGroupParams`
    - `CreateGroupParamsBuilder`
    - `CreateProjectParams`
    - `CreateProjectParamsBuilder`
    - `MergeMethod`
    - `BuildGitStrategy`
    - `AutoDeployStrategy`
    - `WebhookEvents`
    - `CommitStatusInfo`
    - `MergeRequestStateFilter`
    - `RepoFile`
    - `ProjectFeatures`
    - `QueryParamSlice`
    - `QueryParamVec`
  * Now-impossible error conditions have been removed from `GitlabError`.

Ben Boeckel's avatar
Ben Boeckel committed
54
# v0.1300.0
55

56
57
58
59
60
## Deprecations

  * All methods on the `Gitlab` structure now have `Endpoint` structures
    implemented. In a future release, these methods (and their support types)
    will be removed.
61
62
  * The `Serialize` implementations of the API types are deprecated (though
    marking them as such is difficult).
63

64
65
66
67
68
## Changes

  * The `api::projects::issues::Issues` endpoint's `milestone` field was
    changed to match the actual API exposed by GitLab (with `None` and `Any`
    options).
69
  * The `api::projects::pipelines::PipelineVariables` endpoint is now pageable.
70
  * All `EnableState` fields may now be set using `bool` values.
71
72
  * The `api::projects::merge_requests::EditMergeRequest` endpoint now supports
    unlabeling a merge request.
73
74
75
  * The `api::Client` trait has been changed to use the `http` crate types.
    This allows for clients to not be tied to `reqwest` and for mocking and
    testing of the endpoints themselves.
76
  * GitLab errors now detect error objects returned from the API.
77

Ben Boeckel's avatar
Ben Boeckel committed
78
79
80
81
82
## Fixes

  * The `min_access_level` field for `api::groups::Groups` and the
    `access_level` for `api::projects::members::AddProjectMember` are now
    properly passed as integers to the API. (#42)
83
  * The path used for the project and group milestone endpoints has been fixed.
Ben Boeckel's avatar
Ben Boeckel committed
84

Ben Boeckel's avatar
Ben Boeckel committed
85
# v0.1210.2
Ben Boeckel's avatar
Ben Boeckel committed
86

87
88
89
90
91
## New request body handling

It was observed (#41) that the new API pattern was not handling `POST` and
`PUT` parameters properly. This has now been fixed.

92
93
94
95
96
## New request parameter handling

In the process of updating the body handling, a simpler pattern for query
parameters was also implemented.

Ben Boeckel's avatar
Ben Boeckel committed
97
98
99
100
101
## Additional merge status cases

Some additional merge status names for merge requests were missing and have
been added.

102
103
104
105
## Fixes

  * The `api::projects::environments::Environment` endpoint uses the correct
    path now.
106
107
  * The `api::groups::members::GroupMembers`,
    `api::projects::members::ProjectMembers`, and
108
109
    `api::projects::repository::Branches` endpoints now accepts plain strings
    for their `query` fields.
110
111
  * The `api::projects::protected_branches::UnprotectBranch` endpoint now
    properly escapes branch names with URL-special characters.
112
113
114
  * The `api::projects::repository::CreateFile` endpoint now properly upgrades
    the encoding when attempting to encode binary contents using
    `Encoding::Text`.
115
116
  * The `api::projects::CreateProject` and `api::projects::EditProject`
    endpoints now accepts plain strings in its `import_url` field.
117

118
119
120
121
122
## Changes

  * The `api::projects::issues::EditIssue` now uses `issue` rather than
    `issue_iid` for consistency.

Ben Boeckel's avatar
Ben Boeckel committed
123
# v0.1210.1
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199

## New API strategy

A new pattern for API implementation is now underway. Instead of methods
directly on the `Gitlab` instance, there are now structures which implement an
`api::Endpoint` trait. This trait may be used to query any structure
implementing the `api::Client` trait using the `api::Query` trait. All
endpoints use the "builder" pattern to collect required and optional
parameters.

There are some adaptor functions to handle various use cases:

  - `api::paged`: This may be used to handle pagination of any endpoint which
    supports it (checked at compile time).
  - `api::ignore`: This may be used to ignore the content of the response for
    any endpoint. HTTP and GitLab error messages are still captured.
  - `api::raw`: Instead of deserializing the contents of the result from GitLab
    into a structure, the raw bytes may be fetched instead using this function.
  - `api::sudo`: This function adapts any endpoint into being called as another
    user if the client is able to do so (basically, is an administrator).

The `api::Query` trait deserializes the contents from GitLab into any structure
which implements the `serde::DeserializeOwned` trait. This can be used to only
grab information of interest to the caller instead of extracting all of the
information available through the `types` module.

If your endpoint is deprecated, it has been marked as such and you should
migrate to the new pattern. Please see the docs for available endpoints.

All new endpoint implementations should use the new pattern rather than adding
methods to `Gitlab`. Result structures do not need to be added to this crate
either. It is expected that they too will be deprecated at some point and
either not provided or moved to a dedicated crate.

### Examples:

```rust
use std::env;

use serde::Deserialize;
use gitlab::Gitlab;
use gitlab::api::{self, projects, Query};

#[derive(Debug, Deserialize)]
struct Project {
    name: String,
}

fn example() {
    // Create the client.
    let client = Gitlab::new("gitlab.com", env::get("GITLAB_TOKEN").unwrap()).unwrap();

    // Create a simple endpoint.
    let endpoint = projects::Project::builder().project("gitlab-org/gitlab").build().unwrap();
    // Get the information.
    let project: Project = endpoint.query(&client).unwrap();
    // Call it again, but ignore the response from GitLab.
    let _: () = api::ignore(endpoint).query(&client).unwrap();

    // Create an endpoint that supports pagination.
    let pageable_endpoint = projects::Projects::builder().build().unwrap();
    // Get just the first page (20 results).
    let first_page: Vec<Project> = pageable_endpoint.query(&client).unwrap();
    // Get 200 results instead.
    let first_200_projects: Vec<Project> = api::paged(pageable_endpoint, api::Pagination::Limit(200)).query(&client).unwrap();

    // Query `gitlab-org/gitlab` except by ID this time.
    let endpoint = projects::Project::builder().project(278964).build().unwrap();
    // Get the raw data from the response.
    let raw_data: Vec<u8> = api::raw(endpoint).query(&client).unwrap();
}
```

## Changes

  * Include a changelog.