17 |
18 |
19 |
--------------------------------------------------------------------------------
/.github/renovate.json5:
--------------------------------------------------------------------------------
1 | {
2 | $schema: 'https://docs.renovatebot.com/renovate-schema.json',
3 | extends: [
4 | 'config:recommended',
5 | ],
6 | ignorePresets: [
7 | // Ensure we get the latest version and are not pinned to old versions.
8 | 'workarounds:javaLTSVersions',
9 | ],
10 | customManagers: [
11 | // Update .java-version file with the latest JDK version.
12 | {
13 | customType: 'regex',
14 | fileMatch: [
15 | '\\.java-version$',
16 | ],
17 | matchStrings: [
18 | '(?.*)\\n',
19 | ],
20 | datasourceTemplate: 'java-version',
21 | depNameTemplate: 'java',
22 | // Only write the major version.
23 | extractVersionTemplate: '^(?\\d+)',
24 | },
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/website/public/2.x/converter-kotlinx-serialization/images/logo-icon.svg:
--------------------------------------------------------------------------------
1 |
4 |
5 |
15 |
--------------------------------------------------------------------------------
/website/public/2.x/converter-kotlinx-serialization/ui-kit/assets/interface-kotlin.svg:
--------------------------------------------------------------------------------
1 |
4 |
5 |
14 |
--------------------------------------------------------------------------------
/retrofit-converters/jaxb/src/test/java/retrofit2/converter/jaxb/Type.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.converter.jaxb;
17 |
18 | enum Type {
19 | OTHER,
20 | MOBILE
21 | }
22 |
--------------------------------------------------------------------------------
/website/public/2.x/converter-kotlinx-serialization/kotlinx-serialization/package-list:
--------------------------------------------------------------------------------
1 | $dokka.format:html-v1
2 | $dokka.linkExtension:html
3 | $dokka.location:retrofit2.converter.kotlinx.serialization////PointingToDeclaration/kotlinx-serialization/retrofit2.converter.kotlinx.serialization/index.html
4 | $dokka.location:retrofit2.converter.kotlinx.serialization//asConverterFactory/kotlinx.serialization.BinaryFormat#okhttp3.MediaType/PointingToDeclaration/kotlinx-serialization/retrofit2.converter.kotlinx.serialization/as-converter-factory.html
5 | $dokka.location:retrofit2.converter.kotlinx.serialization//asConverterFactory/kotlinx.serialization.StringFormat#okhttp3.MediaType/PointingToDeclaration/kotlinx-serialization/retrofit2.converter.kotlinx.serialization/as-converter-factory.html
6 | retrofit2.converter.kotlinx.serialization
7 |
--------------------------------------------------------------------------------
/website/public/2.x/converter-kotlinx-serialization/ui-kit/assets/enum-kotlin.svg:
--------------------------------------------------------------------------------
1 |
4 |
5 |
14 |
--------------------------------------------------------------------------------
/retrofit-converters/jaxb3/src/test/java/retrofit2/converter/jaxb3/Type.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.converter.jaxb3;
17 |
18 | enum Type {
19 | OTHER,
20 | MOBILE
21 | }
22 |
--------------------------------------------------------------------------------
/website/public/2.x/converter-kotlinx-serialization/images/anchor-copy-button.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | What kind of issue is this?
2 |
3 | - [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do
4 | something, or to understand why something isn't working the way you expect it to, use Stack
5 | Overflow. https://stackoverflow.com/questions/tagged/retrofit
6 |
7 | - [ ] Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests
8 | get fixed. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9
9 |
10 | - [ ] Feature Request. Start by telling us what problem you’re trying to solve. Often a solution
11 | already exists! Don’t send pull requests to implement new features without first getting our
12 | support. Sometimes we leave features out on purpose to keep the project small.
13 |
--------------------------------------------------------------------------------
/website/public/2.x/converter-kotlinx-serialization/ui-kit/assets/typealias-kotlin.svg:
--------------------------------------------------------------------------------
1 |
4 |
5 |
14 |
--------------------------------------------------------------------------------
/retrofit-mock/src/main/java/retrofit2/mock/KotlinExtensions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.mock
17 |
18 | inline fun MockRetrofit.create(): BehaviorDelegate = create(T::class.java)
19 |
--------------------------------------------------------------------------------
/website/public/2.x/adapter-guava/allclasses-noframe.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes (guava API)
7 |
8 |
9 |
10 |
11 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RELEASING.md:
--------------------------------------------------------------------------------
1 | # Releasing
2 |
3 | 1. Update the `VERSION_NAME` in `gradle.properties` to the release version.
4 |
5 | 2. Update the `CHANGELOG.md`:
6 | 1. Change the `Unreleased` header to the release version.
7 | 2. Add a link URL to ensure the header link works.
8 | 3. Add a new `Unreleased` section to the top.
9 |
10 | 3. Update the `README.md` so the "Download" section reflects the new release version.
11 |
12 | 4. Commit
13 |
14 | ```
15 | $ git commit -am "Prepare version X.Y.Z"
16 | ```
17 |
18 | 5. Tag
19 |
20 | ```
21 | $ git tag -am "Version X.Y.Z" X.Y.Z
22 | ```
23 |
24 | 6. Update the `VERSION_NAME` in `gradle.properties` to the next "SNAPSHOT" version.
25 |
26 | 7. Commit
27 |
28 | ```
29 | $ git commit -am "Prepare next development version"
30 | ```
31 |
32 | 8. Push!
33 |
34 | ```
35 | $ git push && git push --tags
36 | ```
37 |
38 | This will trigger a GitHub Action workflow which will create a GitHub release and upload the
39 | release artifacts to Maven Central.
40 |
--------------------------------------------------------------------------------
/retrofit-converters/scalars/README.md:
--------------------------------------------------------------------------------
1 | Java Scalars Converter
2 | ======================
3 |
4 | A `Converter` which supports converting strings and both primitives and their boxed types to
5 | `text/plain` bodies.
6 |
7 |
8 | Download
9 | --------
10 |
11 | Download [the latest JAR][1] or grab via [Maven][2]:
12 | ```xml
13 |
14 | com.squareup.retrofit2
15 | converter-scalars
16 | latest.version
17 |
18 | ```
19 | or [Gradle][2]:
20 | ```groovy
21 | implementation 'com.squareup.retrofit2:converter-scalars:latest.version'
22 | ```
23 |
24 | Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
25 |
26 |
27 |
28 | [1]: https://search.maven.org/remote_content?g=com.squareup.retrofit2&a=converter-scalars&v=LATEST
29 | [2]: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.squareup.retrofit2%22%20a%3A%22converter-scalars%22
30 | [snap]: https://s01.oss.sonatype.org/content/repositories/snapshots/
31 |
--------------------------------------------------------------------------------
/retrofit-adapters/guava/src/main/java/retrofit2/adapter/guava/HttpException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.adapter.guava;
17 |
18 | import retrofit2.Response;
19 |
20 | /** @deprecated Use {@link retrofit2.HttpException}. */
21 | @Deprecated
22 | public final class HttpException extends retrofit2.HttpException {
23 | public HttpException(Response> response) {
24 | super(response);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/retrofit-adapters/java8/src/main/java/retrofit2/adapter/java8/HttpException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.adapter.java8;
17 |
18 | import retrofit2.Response;
19 |
20 | /** @deprecated Use {@link retrofit2.HttpException}. */
21 | @Deprecated
22 | public final class HttpException extends retrofit2.HttpException {
23 | public HttpException(Response> response) {
24 | super(response);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/website/public/1.x/converter-jackson/retrofit/converter/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | retrofit.converter (Converter: Jackson 1.9.0 API)
8 |
9 |
10 |
11 |
12 |
13 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/retrofit-adapters/rxjava2/src/main/java/retrofit2/adapter/rxjava2/HttpException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.adapter.rxjava2;
17 |
18 | import retrofit2.Response;
19 |
20 | /** @deprecated Use {@link retrofit2.HttpException}. */
21 | @Deprecated
22 | public final class HttpException extends retrofit2.HttpException {
23 | public HttpException(Response> response) {
24 | super(response);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/retrofit-adapters/rxjava3/src/main/java/retrofit2/adapter/rxjava3/HttpException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.adapter.rxjava3;
17 |
18 | import retrofit2.Response;
19 |
20 | /** @deprecated Use {@link retrofit2.HttpException}. */
21 | @Deprecated
22 | public final class HttpException extends retrofit2.HttpException {
23 | public HttpException(Response> response) {
24 | super(response);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/website/public/1.x/retrofit-mock/retrofit/android/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | retrofit.android (Retrofit Mock Adapter 1.9.0 API)
8 |
9 |
10 |
11 |
12 |
13 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/retrofit-converters/gson/README.md:
--------------------------------------------------------------------------------
1 | Gson Converter
2 | ==============
3 |
4 | A `Converter` which uses [Gson][1] for serialization to and from JSON.
5 |
6 | A default `Gson` instance will be created or one can be configured and passed to the
7 | `GsonConverterFactory` to further control the serialization.
8 |
9 |
10 | Download
11 | --------
12 |
13 | Download [the latest JAR][2] or grab via [Maven][3]:
14 | ```xml
15 |
16 | com.squareup.retrofit2
17 | converter-gson
18 | latest.version
19 |
20 | ```
21 | or [Gradle][3]:
22 | ```groovy
23 | implementation 'com.squareup.retrofit2:converter-gson:latest.version'
24 | ```
25 |
26 | Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
27 |
28 |
29 |
30 | [1]: https://github.com/google/gson
31 | [2]: https://search.maven.org/remote_content?g=com.squareup.retrofit2&a=converter-gson&v=LATEST
32 | [3]: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.squareup.retrofit2%22%20a%3A%22converter-gson%22
33 | [snap]: https://s01.oss.sonatype.org/content/repositories/snapshots/
34 |
--------------------------------------------------------------------------------
/retrofit-converters/moshi/README.md:
--------------------------------------------------------------------------------
1 | Moshi Converter
2 | ===============
3 |
4 | A `Converter` which uses [Moshi][1] for serialization to and from JSON.
5 |
6 | A default `Moshi` instance will be created or one can be configured and passed to
7 | `MoshiConverterFactory.create()` to further control the serialization.
8 |
9 |
10 | Download
11 | --------
12 |
13 | Download [the latest JAR][2] or grab via [Maven][3]:
14 | ```xml
15 |
16 | com.squareup.retrofit2
17 | converter-moshi
18 | latest.version
19 |
20 | ```
21 | or [Gradle][3]:
22 | ```groovy
23 | implementation 'com.squareup.retrofit2:converter-moshi:latest.version'
24 | ```
25 |
26 | Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
27 |
28 |
29 |
30 | [1]: https://github.com/square/moshi
31 | [2]: https://search.maven.org/remote_content?g=com.squareup.retrofit2&a=converter-moshi&v=LATEST
32 | [3]: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.squareup.retrofit2%22%20a%3A%22converter-moshi%22
33 | [snap]: https://s01.oss.sonatype.org/content/repositories/snapshots/
34 |
--------------------------------------------------------------------------------
/retrofit/kotlin-test/src/test/java/retrofit2/KotlinExtensionsTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2
17 |
18 | import okhttp3.mockwebserver.MockWebServer
19 | import org.junit.Assert.assertNotNull
20 | import org.junit.Rule
21 | import org.junit.Test
22 |
23 | class KotlinExtensionsTest {
24 | @get:Rule val server = MockWebServer()
25 |
26 | interface Empty
27 |
28 | @Test fun reifiedCreate() {
29 | val retrofit = Retrofit.Builder()
30 | .baseUrl(server.url("/"))
31 | .build()
32 |
33 | assertNotNull(retrofit.create())
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/retrofit-converters/jackson/README.md:
--------------------------------------------------------------------------------
1 | Jackson Converter
2 | =================
3 |
4 | A `Converter` which uses [Jackson][1] for serialization to and from JSON.
5 |
6 | A default `ObjectMapper` instance will be created or one can be configured and passed to the
7 | `JacksonConverterFactory` construction to further control the serialization.
8 |
9 |
10 | Download
11 | --------
12 |
13 | Download [the latest JAR][2] or grab via [Maven][3]:
14 | ```xml
15 |
16 | com.squareup.retrofit2
17 | converter-jackson
18 | latest.version
19 |
20 | ```
21 | or [Gradle][3]:
22 | ```groovy
23 | implementation 'com.squareup.retrofit2:converter-jackson:latest.version'
24 | ```
25 |
26 | Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
27 |
28 |
29 |
30 | [1]: https://github.com/FasterXML/jackson
31 | [2]: https://search.maven.org/remote_content?g=com.squareup.retrofit2&a=converter-jackson&v=LATEST
32 | [3]: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.squareup.retrofit2%22%20a%3A%22converter-jackson%22
33 | [snap]: https://s01.oss.sonatype.org/content/repositories/snapshots/
34 |
35 |
--------------------------------------------------------------------------------
/website/public/2.x/retrofit-mock/allclasses-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes (retrofit-mock API)
7 |
8 |
9 |
10 |
11 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/retrofit-converters/guava/src/test/java/retrofit/converter/guava/AlwaysNullConverterFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit.converter.guava;
17 |
18 | import java.lang.annotation.Annotation;
19 | import java.lang.reflect.Type;
20 | import okhttp3.ResponseBody;
21 | import retrofit2.Converter;
22 | import retrofit2.Retrofit;
23 |
24 | final class AlwaysNullConverterFactory extends Converter.Factory {
25 | @Override
26 | public Converter responseBodyConverter(
27 | Type type, Annotation[] annotations, Retrofit retrofit) {
28 | return value -> null;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/retrofit-converters/java8/src/test/java/retrofit/converter/java8/AlwaysNullConverterFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit.converter.java8;
17 |
18 | import java.lang.annotation.Annotation;
19 | import java.lang.reflect.Type;
20 | import okhttp3.ResponseBody;
21 | import retrofit2.Converter;
22 | import retrofit2.Retrofit;
23 |
24 | final class AlwaysNullConverterFactory extends Converter.Factory {
25 | @Override
26 | public Converter responseBodyConverter(
27 | Type type, Annotation[] annotations, Retrofit retrofit) {
28 | return value -> null;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/website/public/2.x/adapter-rxjava2/retrofit2/adapter/rxjava2/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | retrofit2.adapter.rxjava2 (rxjava2 API)
7 |
8 |
9 |
10 |
11 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/retrofit/src/main/java/retrofit2/http/Multipart.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.http;
17 |
18 | import static java.lang.annotation.ElementType.METHOD;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | import java.lang.annotation.Documented;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Denotes that the request body is multi-part. Parts should be declared as parameters and annotated
27 | * with {@link Part @Part}.
28 | */
29 | @Documented
30 | @Target(METHOD)
31 | @Retention(RUNTIME)
32 | public @interface Multipart {}
33 |
--------------------------------------------------------------------------------
/website/public/1.x/retrofit/retrofit/android/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | retrofit.android (Retrofit 1.9.0 API)
8 |
9 |
10 |
11 |
12 |
13 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/website/src/content/docs/contributing.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Contributing
3 | ---
4 |
5 | If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request.
6 | When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. Please also make sure your code compiles by running `./gradlew build` (or `gradlew.bat build` for Windows).
7 | Before your code can be accepted into the project you must also sign the [Individual Contributor License Agreement (CLA)](https://squ.re/sign-the-cla).
8 |
9 |
10 | ## License
11 |
12 | ```
13 | Copyright 2013 Square, Inc.
14 |
15 | Licensed under the Apache License, Version 2.0 (the "License");
16 | you may not use this file except in compliance with the License.
17 | You may obtain a copy of the License at
18 |
19 | http://www.apache.org/licenses/LICENSE-2.0
20 |
21 | Unless required by applicable law or agreed to in writing, software
22 | distributed under the License is distributed on an "AS IS" BASIS,
23 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 | See the License for the specific language governing permissions and
25 | limitations under the License.
26 | ```
27 |
--------------------------------------------------------------------------------
/retrofit-converters/jaxb3/README.md:
--------------------------------------------------------------------------------
1 | JAXB Converter
2 | ==============
3 |
4 | A `Converter` which uses [JAXB][1] 3.x (`jakarta.xml.bind` package) for serialization to and from XML.
5 |
6 | A default `JAXBContext` instance will be created or one can be configured and passed
7 | to `JaxbConverterFactory.create()` to further control the serialization.
8 |
9 | **Note that JAXB does not work on Android.**
10 |
11 | Download
12 | --------
13 |
14 | Download [the latest JAR][2] or grab via [Maven][3]:
15 | ```xml
16 |
17 | com.squareup.retrofit2
18 | converter-jaxb3
19 | latest.version
20 |
21 | ```
22 | or [Gradle][3]:
23 | ```groovy
24 | implementation 'com.squareup.retrofit2:converter-jaxb3:latest.version'
25 | ```
26 |
27 | Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
28 |
29 |
30 |
31 | [1]: https://github.com/eclipse-ee4j/jaxb-ri
32 | [2]: https://search.maven.org/remote_content?g=com.squareup.retrofit2&a=converter-jaxb3&v=LATEST
33 | [3]: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.squareup.retrofit2%22%20a%3A%22converter-jaxb%322
34 | [snap]: https://s01.oss.sonatype.org/content/repositories/snapshots/
35 |
--------------------------------------------------------------------------------
/retrofit/test-helpers/src/main/java/retrofit2/helpers/DelegatingCallAdapterFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.helpers;
17 |
18 | import java.lang.annotation.Annotation;
19 | import java.lang.reflect.Type;
20 | import retrofit2.CallAdapter;
21 | import retrofit2.Retrofit;
22 |
23 | public final class DelegatingCallAdapterFactory extends CallAdapter.Factory {
24 | public boolean called;
25 |
26 | @Override
27 | public CallAdapter, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) {
28 | called = true;
29 | return retrofit.nextCallAdapter(this, returnType, annotations);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/website/public/1.x/retrofit-mock/allclasses-noframe.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | All Classes (Retrofit Mock Adapter 1.9.0 API)
8 |
9 |
10 |
11 |
12 |
13 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/retrofit/test-helpers/src/main/java/retrofit2/helpers/NonMatchingCallAdapterFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.helpers;
17 |
18 | import java.lang.annotation.Annotation;
19 | import java.lang.reflect.Type;
20 | import javax.annotation.Nullable;
21 | import retrofit2.CallAdapter;
22 | import retrofit2.Retrofit;
23 |
24 | public final class NonMatchingCallAdapterFactory extends CallAdapter.Factory {
25 | public boolean called;
26 |
27 | @Override
28 | public @Nullable CallAdapter, ?> get(
29 | Type returnType, Annotation[] annotations, Retrofit retrofit) {
30 | called = true;
31 | return null;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/retrofit/src/main/java16/retrofit2/DefaultMethodSupport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2;
17 |
18 | import java.lang.reflect.InvocationHandler;
19 | import java.lang.reflect.Method;
20 | import javax.annotation.Nullable;
21 |
22 | /** Java 16 finally has a public API for invoking default methods on a proxy. */
23 | final class DefaultMethodSupport {
24 | @Nullable
25 | static Object invoke(
26 | Method method, Class> declaringClass, Object proxy, @Nullable Object[] args)
27 | throws Throwable {
28 | return InvocationHandler.invokeDefault(proxy, method, args);
29 | }
30 |
31 | private DefaultMethodSupport() {}
32 | }
33 |
--------------------------------------------------------------------------------
/retrofit/src/main/java/retrofit2/http/Streaming.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.http;
17 |
18 | import static java.lang.annotation.ElementType.METHOD;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | import java.lang.annotation.Documented;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.Target;
24 | import okhttp3.ResponseBody;
25 |
26 | /**
27 | * Treat the response body on methods returning {@link ResponseBody ResponseBody} as is, i.e.
28 | * without converting the body to {@code byte[]}.
29 | */
30 | @Documented
31 | @Target(METHOD)
32 | @Retention(RUNTIME)
33 | public @interface Streaming {}
34 |
--------------------------------------------------------------------------------
/website/public/2.x/retrofit-mock/retrofit2/mock/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | retrofit2.mock (retrofit-mock API)
7 |
8 |
9 |
10 |
11 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/retrofit-adapters/rxjava/src/test/java/retrofit2/adapter/rxjava/ForwardingSubscriber.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Square, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package retrofit2.adapter.rxjava;
17 |
18 | import rx.Subscriber;
19 |
20 | abstract class ForwardingSubscriber extends Subscriber {
21 | private final Subscriber delegate;
22 |
23 | ForwardingSubscriber(Subscriber delegate) {
24 | this.delegate = delegate;
25 | }
26 |
27 | @Override
28 | public void onNext(T value) {
29 | delegate.onNext(value);
30 | }
31 |
32 | @Override
33 | public void onCompleted() {
34 | delegate.onCompleted();
35 | }
36 |
37 | @Override
38 | public void onError(Throwable throwable) {
39 | delegate.onError(throwable);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------