swh.web.add_forge_now.api_views module#

class swh.web.add_forge_now.api_views.AddForgeNowRequestForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]#

Bases: ModelForm

class Meta[source]#

Bases: object

model#

alias of Request

fields = ('forge_type', 'forge_url', 'forge_contact_email', 'forge_contact_name', 'forge_contact_comment', 'submitter_forward_username')#
base_fields = {'forge_contact_comment': <django.forms.fields.CharField object>, 'forge_contact_email': <django.forms.fields.EmailField object>, 'forge_contact_name': <django.forms.fields.CharField object>, 'forge_type': <django.forms.fields.CharField object>, 'forge_url': <django.forms.fields.URLField object>, 'submitter_forward_username': <django.forms.fields.BooleanField object>}#
declared_fields = {'forge_contact_comment': <django.forms.fields.CharField object>}#
property media#

Return all media required to render the widgets on this form.

class swh.web.add_forge_now.api_views.AddForgeNowRequestHistoryForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]#

Bases: ModelForm

class Meta[source]#

Bases: object

model#

alias of RequestHistory

fields = ('text', 'new_status')#
base_fields = {'new_status': <django.forms.fields.CharField object>, 'text': <django.forms.fields.CharField object>}#
declared_fields = {'new_status': <django.forms.fields.CharField object>}#
property media#

Return all media required to render the widgets on this form.

class swh.web.add_forge_now.api_views.AddForgeNowRequestSerializer(*args, **kwargs)[source]#

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]#

Bases: object

model#

alias of Request

fields = '__all__'#
class swh.web.add_forge_now.api_views.AddForgeNowRequestPublicSerializer(*args, **kwargs)[source]#

Bases: ModelSerializer

Serializes AddForgeRequest without private fields.

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]#

Bases: object

model#

alias of Request

fields = ('id', 'forge_url', 'forge_type', 'status', 'submission_date')#
class swh.web.add_forge_now.api_views.AddForgeNowRequestHistorySerializer(*args, **kwargs)[source]#

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]#

Bases: object

model#

alias of RequestHistory

exclude = ('request', 'message_source')#
get_message_source_url(request_history)[source]#
class swh.web.add_forge_now.api_views.AddForgeNowRequestHistoryPublicSerializer(*args, **kwargs)[source]#

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]#

Bases: object

model#

alias of RequestHistory

fields = ('id', 'date', 'new_status', 'actor_role')#
swh.web.add_forge_now.api_views.api_add_forge_request_create(request: HttpRequest | Request) HttpResponse[source]#
POST /api/1/add-forge/request/create/#

Create a new request to add a forge to the list of those crawled regularly by Software Heritage.

Warning

That endpoint is not publicly available and requires authentication in order to be able to request it.

Request Headers:
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers:
Request JSON Object:
  • forge_type (string) – the type of forge

  • forge_url (string) – the base URL of the forge

  • forge_contact_email (string) – email of an administrator of the forge to contact

  • forge_contact_name (string) – the name of the administrator

  • forge_contact_comment (string) – to explain how Software Heritage can verify forge administrator info are valid

Status Codes:
swh.web.add_forge_now.api_views.api_add_forge_request_update(request: HttpRequest | Request, id: int) HttpResponse[source]#
POST /api/1/add-forge/request/(id)/update/#

Update a request to add a forge to the list of those crawled regularly by Software Heritage.

Warning

That endpoint is not publicly available and requires authentication in order to be able to request it.

Request Headers:
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers:
Request JSON Object:
  • text (string) – comment about new request status

  • new_status (string) – the new request status

Status Codes:
swh.web.add_forge_now.api_views.api_add_forge_request_list(request: Request)[source]#
GET /api/1/add-forge/request/list/#

List add forge requests submitted by users.

Request Headers:
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers:
  • Content-Type – this depends on Accept header of request

  • Link – indicates that a subsequent result page is available and contains the url pointing to it

Query Parameters:
  • page (int) – optional page number

  • per_page (int) – optional number of elements per page (bounded to 1000)

Status Codes:
swh.web.add_forge_now.api_views.api_add_forge_request_get(request: Request, id: int)[source]#
GET /api/1/add-forge/request/(id)/get/#

Return all details about an add-forge request.

Request Headers:
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers:
Parameters:
  • id (int) – add-forge request identifier

Status Codes: