Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

feat!: move API to python microgenerator #22

Merged
merged 11 commits into from Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.rst
Expand Up @@ -34,6 +34,16 @@ In order to use this library, you first need to go through the following steps:
.. _Enable the Cloud Talent Solution API.: https://cloud.google.com/jobs
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.6

Deprecated Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^
Python == 2.7.

The last version of this library compatible with Python 2.7 is google-cloud-talent==0.6.1.

Installation
~~~~~~~~~~~~

Expand Down
106 changes: 106 additions & 0 deletions UPGRADING.md
@@ -0,0 +1,106 @@
# 1.0.0 Migration Guide

The 1.0.0 release of the `google-cloud-talent` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.

If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-talent/issues).

## Supported Python Versions

> **WARNING**: Breaking change
The 1.0.0 release requires Python 3.6+.

## Method Calls

> **WARNING**: Breaking change
Methods expect request objects. We provide a script that will convert most common use cases.
* Install the library
```py
python3 -m pip install google-cloud-talent
```

* The scripts `fixup_talent_v4beta1_keywords.py` shipped with the library. It expects
an input directory (with the code to convert) and an empty destination directory.

```sh
$ fixup_talent_v1_keywords.py --input-directory .samples/ --output-directory samples/
```

**Before:**
```py
from google.cloud import talent_v4beta1
client = talent_v4beta1.JobServiceClient()
parent = client.project_path('[PROJECT]')
# TODO: Initialize `jobs`:
jobs = []
response = client.batch_create_jobs(parent, jobs)
```

**After:**
```py
response = client.batch_create_jobs(request={"parent": "''", "jobs": "[]"})
```

### More Details

In `google-cloud-talent<1.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.

**Before:**
```py
def batch_create_jobs(
self,
parent,
jobs,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
```

In the 1.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.

Some methods have additional keyword only parameters. The available parameters depend on the [`google.api.method_signature` annotation] (https://github.com/googleapis/googleapis/blob/master/google/cloud/talent/v4beta1/job_service.proto#L73) specified by the API producer.


**After:**
```py
def batch_create_jobs(
self,
request: job_service.BatchCreateJobsRequest = None,
*,
parent: str = None,
jobs: Sequence[job.Job] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
```

> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
> Passing both will result in an error.
Both of these calls are valid:
```py
response = client.batch_create_jobs(
request={
"parent": parent,
"jobs": jobs,
}
)
```

```py
response = client.batch_create_jobs(
parent=parent,
jobs=jobs,
)
```

This call is invalid because it mixes `request` with a keyword argument `jobs`. Executing this code will result in an error.

```py
response = client.batch_create_jobs(
request={
"parent": parent,
},
jobs=jobs
)
```
1 change: 1 addition & 0 deletions docs/UPGRADING.md
6 changes: 0 additions & 6 deletions docs/gapic/v4beta1/api.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/gapic/v4beta1/types.rst

This file was deleted.

14 changes: 12 additions & 2 deletions docs/index.rst
Expand Up @@ -7,10 +7,20 @@ Api Reference
.. toctree::
:maxdepth: 2

gapic/v4beta1/api
gapic/v4beta1/types
talent_v4beta1/services
talent_v4beta1/types
changelog

Migration Guide
---------------

See the guide below for instructions on migrating to the 2.x release of this library.

.. toctree::
:maxdepth: 2

UPGRADING

Changelog
---------

Expand Down
24 changes: 24 additions & 0 deletions docs/talent_v4beta1/services.rst
@@ -0,0 +1,24 @@
Services for Google Cloud Talent v4beta1 API
============================================

.. automodule:: google.cloud.talent_v4beta1.services.application_service
:members:
:inherited-members:
.. automodule:: google.cloud.talent_v4beta1.services.company_service
:members:
:inherited-members:
.. automodule:: google.cloud.talent_v4beta1.services.completion
:members:
:inherited-members:
.. automodule:: google.cloud.talent_v4beta1.services.event_service
:members:
:inherited-members:
.. automodule:: google.cloud.talent_v4beta1.services.job_service
:members:
:inherited-members:
.. automodule:: google.cloud.talent_v4beta1.services.profile_service
:members:
:inherited-members:
.. automodule:: google.cloud.talent_v4beta1.services.tenant_service
:members:
:inherited-members:
5 changes: 5 additions & 0 deletions docs/talent_v4beta1/types.rst
@@ -0,0 +1,5 @@
Types for Google Cloud Talent v4beta1 API
=========================================

.. automodule:: google.cloud.talent_v4beta1.types
:members:
41 changes: 0 additions & 41 deletions google/cloud/talent.py

This file was deleted.