Skip to content

krateoplatformops/git-service

Repository files navigation

Git Service

This service is used to get files from a git repository.

We can manage this types of git repository:

  • github (public and private)
  • bitbucket (on-premise)
  • gitlab (public)
  • azuredevops (public)

Independently of the git service, this service needs an endpoint to get the files.

Routes

GET /:endpointName/:docs

  • endpointName: the name of the endpoint
  • docs: is the list of documents to get, separated by a comma if multiple docs

Example

This path is using the github endpoint to get the README.md in the repository krateoplatformops/krateo

github/%5Bkrateoplatformops%5D%5Bkrateo%5DREADME.md

as you can see the docs list is encoded in the path.

Response

{
  "list": [
    {
      "name": "README.md",
      "content": "PGltZyBzcmM9ImRvY3MvbWVkaWEvbG9nby5zdmciIGFsdD0iS3JhdGVvIFBs\nYXRmb3Jtb3BzIiB3aWR0aD0iNDAwIj4KCioqS3JhdGVvIFBsYXRmb3Jtb3Bz\nKiogaXMgYW4gb3BlbiBzb3VyY2UgdG9vbCwgYmFzZWQgb24gQ05DRiBwcm9q\nZWN0cyBzdWNoIGFzIEt1YmVybmV0ZXMgYW5kIENyb3NzcGxhbmUsIHRoYXQg\nZ2l2ZXMgdXNlcnMgdGhlIGNhcGFiaWxpdHkgdG8gY3JlYXRlIGFueSBkZXNp\ncmVkIHJlc291cmNlIG9uIGJhc2ljYWxseSBhbnkgaW5mcmFzdHJ1Y3R1cmUg\ndGhleSdkIGxpa2UuIEJlIGl0IGEgSzhzIGNsdXN0ZXIsIG1pY3Jvc2Vydmlj\nZSwgYXBwbGljYXRpb24sIHBpcGVsaW5lLCBkYXRhYmFzZSBvciBhbnl0aGlu\nZyBlbHNlLCBLcmF0ZW8gaGFzIGdvdCB5b3VyIGJhY2suIFRoZSBvbmx5IHJl\ncXVpcmVtZW50IGlzIGZvciB0aGUgcmVzb3VyY2UgdG8gYmUgZGVzY3JpcHRp\nYmxlIHZpYSBhIFlBTUwgZmlsZSByZXByZXNlbnRpbmcgdGhlIHJlc291cmNl\nJ3MgX2Rlc2lyZWQgc3RhdGVfIChyaW5ncyBhIGJlbGw/IPCfmIkpLg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ldGVzIGNsdXN0ZXIu\nCgojIyBHZXR0aW5nIHN0YXJ0ZWQKCkJlZm9yZSBpbnN0YWxsIEtyYXRlbywg\ncGxlYXNlIHZlcmlmeSBvdXIgW3JlcXVpcmVtZW50c10oLi9kb2NzL1JFUVVJ\nUkVNRU5UUy5tZCkuCgpHZXR0aW5nIHN0YXJ0ZWQgd2l0aCBLcmF0ZW8gaXMg\nYXMgZWFzeSBhcyBmb2xsb3dpbmcgaXRzIFtpbnN0YWxsYXRpb24gaW5zdHJ1\nY3Rpb25zXSguL2RvY3MvSU5TVEFMTC5tZCkuCgojIyBSZWZlcmVuY2UgYXJj\naGl0ZWN0dXJlCgpXZSBhcmUgYXdhcmUgd2UgaGF2ZSBtZW50aW9uZWQgbWFu\neSBkaWZmZXJlbnQgc29mdHdhcmUgY29tcG9uZW50cyBzbyBmYXIsIHRodXMg\nd2Ugc2VlIHdoeSB5b3UgbWF5IGJlIGEgdGFkIGNvbmZ1c2VkLiBJbiBzdW1t\nYXJ5LCBLcmF0ZW8nIHJlZmVyZW5jZSBhcmNoaXRlY3R1cmUgY2FuIGJlIGRl\ncGljdGVkIGFzIGZvbGxvd3M6Cgo8aW1nIHNyYz0iZG9jcy9tZWRpYS9yZWZl\ncmVuY2VfYXJjaGl0ZWN0dXJlLnBuZyIgd2lkdGg9IjcwMHB4IiBhbHQ9IlJl\nZmVyZW5jZSBhcmNoaXRlY3R1cmUiLz4KCiMjIEhvdyBkb2VzIGl0IHdvcms/\nCgo8aW1nIHNyYz0iZG9jcy9tZWRpYS9ob3dfZG9lc19pdF93b3JrLnBuZyIg\nd2lkdGg9IjcwMHB4IiBhbHQ9IkhvdyBkb2VzIGl0IHdvcmsiLz4K\n"
    }
  ],
  "count": 1
}

!!! Note

Services respond with valid JSON, so, if the response is an array, it will be wrapped in the `list` property.

If the response contains the `list` proerty it will add the property `count` with the number of items in the list.